# 请求结构

# 1 请求方法

fogcloud 云平台支持以下请求方法

方法

说明

GET

获取指定资源

PUT

更新指定资源

POST

执行特定操作

DELETE

删除指定资源

说明:当请求方法为 POST 时,Content-Type 参数值为<span class="ne-text">application/json</span>

# 2 请求头公共参数

参数名

类型

必填

说明

access_key

string

true

项目 access_key

sign

string

true

采用指定签发算法计算得到的签名

sign_method

string

true

签名摘要算法,可选:hmacsha1,hmacmd5,hmacsha256

timestamp

int64

true

时间戳,单位 s

random_str

string

true

随机字符串,长度 5~10

# 3 公共返回参数

API 返回结果采用统一格式;返回 2xx HTTP 状态码代表调用成功,返回 4xx 或 5xx HTTP 状态码代表调用失败。调用成功返回 JSON 格式数据。

  • 返回参数:

字段名

类型

说明

code

int64

错误码。

0-请求成功,

其他-请求失败,

(具体错误信息请参照错误码对照表)

message

string

错误信息

  • 返回示例:
{
    "code": 0,
    "message": "xxxx",
    "data": {...}
}

# 4 请求示例

以获取设备0514f57074f64e9iidna详细信息 API 为例:

  • API 请求:
GET https://fogapi.mxchip.com.cn/openapi/v1/things/0514f57074f64e9iidna/detail
  • 请求头:
access_key: GmXM0L69da381d51
sign: fd764e137295bc46ef8cc89389cfd70b29cc1578
sign_method: hmacsha1
timestamp: 1688925778
random_str: 49aafe
更新时间: 2022/6/6 下午4:10:39