Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
banben
banben
版本

默认情况下当客户端访问https://cn.vnnox.com时,系统将使用V1 版REST API提供服务,我们建议您在http请求的heaer中的`Accept`字段加上服务版本号。格式如下:

Code Block
firstline1
titleAcceptHTTP header
linenumberstrue
Accept:application/nova.vnnox.v1+json

...

所有请求均通过HTTPS协议,API请求链接为https://cn.vnnox.com,所有数据的请求及相应均通过json格式。

Request Header

Code Block
firstline1
titleHTTP Request Header
linenumberstrue
Content-Type:application/json;charset=utf-8


Response数据结构

Code Block
firstline1
titledata structure
linenumberstrue
collapsetrue
{
    "http_code": 200,            //http状态码(重要:请使用http协议本身的状态码做异常捕获,response data中http_code字段后期会取消掉)
    "data": {...some data...},   //数据部分
    "status": [10000001]         //业务相关状态码
}

...

如上面的例子,本文档所有涉及{host}均指https://cn.vnnox.com/,建议第三方开发者将com,建议第三方开发者将{host}信息作为可配置项

错误调试
Anchor
cuowu
cuowu

...

Code Block
firstline1
titleRequest HeaderHTTP header
token:5c1354529946bc49360641f7f321611698deb371

...

使用Oauth2.0认证的REST API访问,同一个用户获取的token访问频次建议1小时内不要超过3000次。

Anchor
daili
daili

...

用户代理

所有的API请求一般都会包含User-Agent header. Requests with no User-Agent header will be rejected. We request that you use your GitHub username, or the name of your application, for the User-Agent header value. This allows us to contact you if there are problems.

Here's an example:

 header,例如浏览器会默认设定为`Mozilla/5.0`等,如果第三方应用对接VNNOX REST API,请参照如下设置:

Code Block
firstline1
titleUser AgentHTTP header
User-Agent: Vnnox-User-App

如果应用的HTTP请求中没有此参数设定,系统无法验证当前用户的Request请求来源,可能会影响到数据的访问。