API简介

燃灯房价牌接口文档(此接口为增值服务,收费开通,密钥和接口费用咨询商家)

API基础URL:https://www.rdfjp.com/api/

默认数据格式:JSON

接口列列表

1. 获取房价信息

端点: POST /api/getprice

描述: 根据用户ID获取房价信息。

2. 更新房价

端点: POST /api/updprice

描述: 创建新的用户账户。

1. 获取房价信息

请求路径 (POST /api/getprice)

字段 类型 是否必填 描述
username string 用户名,必须唯一
sign string 签名字符串,签名算法与支付宝签名算法相同

响应参数

字段名 参数 类型 描述
返回状态码 code String 0为成功,其它值为失败
返回信息 msg String 成功/失败时返回对应信息
数据集合 data Array 返回价格信息数组
数据行数 count int 返回价格信息数量

data参数

字段名 参数 类型 描述
编号 id String 房价编号,修改时使用
房型 title String
price1 title String 价格1
price2 title String 价格2
price3 title String 价格3
price4 title String 价格4
price5 title String 价格5
是否满房 full String 0未满,1已满房
是否显示 display String 0不显示,1显示

2. 更新房价信息

请求路径 (POST /api/updprice)

字段 类型 是否必填 描述
username string 用户名,必须唯一
id string 房价编号
title string 房型名称
price1 string 价格1
price2 string 价格2
price3 string 价格3
price4 string 价格4
price5 string 价格5
full string 是否满房:0未满,1已满房
display string 是否显示:0不显示,1显示
sign string 签名字符串,签名算法与支付宝签名算法相同

响应参数

字段名 参数 类型 描述
返回状态码 code String 0为成功,其它值为失败
返回信息 msg String 成功/失败时返回对应信息

签名算法

签名字符串,签名算法与支付宝签名算法相同
1、将发送或接收到的所有参数按照参数名ASCII码从小到大排序(a-z),sign、和空值不参与签名!
2、将排序后的参数拼接成URL键值对的格式,例如 a=b&c=d&e=f,参数值不要进行url编码。
3、再将拼接好的字符串与商户密钥进行MD5加密得出sign签名参数,sign = md5 ( a=b&c=d&e=f + KEY )
(注:+ 为拼接符,不是字符!),md5结果为小写。
            

示例代码

JavaScript (Fetch API)

fetch('https://api.example.com/v1/user/123', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

cURL

curl -X GET \
  https://api.example.com/v1/user/123 \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'

Python

import requests

url = "https://api.example.com/v1/user/123"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

response = requests.get(url, headers=headers)
print(response.json())