• 一起嗨起来!大国重器组团跳“机械舞” 2019-05-24
  • 楼市下半年或持续降温 房地产长效机制加速推进 2019-05-24
  • 今年江西千万元公益金买服务 受益者将更广泛 2019-05-23
  • 干细胞-热门标签-华商生活 2019-05-23
  • 网购陷阱多 女子花3000元买5套化妆品只有2套是真的 2019-05-22
  • 新华网评:凝聚打赢脱贫攻坚战的强大合力 2019-05-22
  • 广图:神“摄”手初养成计划:摄影师爸爸成长篇 2019-05-21
  • 神奇!这种纸能千年不腐 默默记录西藏 2019-05-20
  • 东西方坦克大赛PK 到底谁家的赛制更实战? 2019-05-20
  • 2月涉旅舆情生态云南旅游形象遭受重创亟待“救赎” 2019-05-19
  • 三位基层书记的一周:思想不转换 其他都白扯 2019-05-18
  • 异类非人思维。如一尼安德特人从2万年前发出的声音。 2019-05-17
  • 广东暴雨4人“疑似被电击”致死 市民上街提心吊胆 2019-05-16
  • 日本连续6次挺进世界杯 今晚首秀 2019-05-15
  • 为人民谋幸福的前进脚步——十九大报告中的民生看点 2019-05-14
  • APP365 Open API 开发指南

    35选7号码走势图 www.gtalq.tw APP365提供的Open API是典型的RESTful API,让你能非常容易地将自己的应用与APP365进行集成; 你可以在应用程序中按照自己的需要查询或修改运单、车辆、车次、客户、司机、出入库信息、运输过程信息、跟踪信息、财务信息等; APP365 Open API采用JSON作为请求和响应的数据格式。

    在你考虑自己创建与APP365集成的??槭?,请先检查“插件工具”栏目中是否已经提供了相同的???,以免重复劳动。


    获取API认证许可

    概述

    当前的APP365 Open API 仅支持HTTP Basic access authentication认证方式;API调用连接必须通过安全的HTTPS连接;证书信息由一个有效的用户名和其关联的API Key组成; 请参见下节的“启用 APP365 Open API”,以了解怎样获取一个API Key;在调用时,如果证书无效或者没有提供,服务器会返回“401未经授权”的响应。


    为用户启用 APP365 Open API

    要授权一个用户让其可以调用API,请按照下列步骤操作:

    • 进入物流系统,选择菜单项:基础设置->个人资料
    • 在出现的界面底部的“登录信息”栏目中,点击“API Key”旁边的“生成”按钮,即可生成一个32位的Key
    • 点击整个界面上方的“保存”按钮,保存相关信息
    • 请注意,APP365中调用API需要提供Client ID到服务器端进行调用,请同时记下API Key下方的Client ID
    feature1


    配置权限

    在角色??橹?,配置指定角色能够存取的资源和可以执行的动作,让特定的角色只能访问与自己相关的资源和动作,保证系统数据的安全。 在调用API时,采用同样地策略来控制用户的访问权限,如果用户无权访问指定的资源,则会返回响应 “403 Forbidden”。


    发起服务调用请求

    登录授权

    要调用APP365 API,你需要在执行请求时,设置Basic HTTP Authorization头部:username:api_key.

    如果使用cURL工具,你可以采用下面两种方式之一请求登录授权:

    通过"--user"参数构造登录授权的头部

    curl --user apiUsername:api_key

    通过"--header"参数直接设置登录授权的头部

    curl --header "Authorization: Basic YWRtaW46WW91ckFQSUtleUhlcmU="


    服务调用

    APP365 Open API采用JSON作为请求和响应的数据格式,API分为三种类型,查询数据、保存数据、删除数据:

    查询数据

    查找单条记录URL://biz.app365.com/bizweb/services/bizobjects

    /m56.Barcode /* 实体模型id */
    /{id}?fields=station_name,barcodes /* 记录id及其要查询返回的字段列表*/

    查询列表URL: //biz.app365.com/bizweb/services/query

    /ilms.LmsOrder.selectForList /* 要执行的SqlId */
    /"o.name": 'lgh', "o.code": 'fff'/0,100 /* 查询条件参数,查询记录的offset limit*/

    完整的请求举例:

    curl --request GET \
    --header "Authorization: Basic YWRtaW46WW91ckFQSUtleUhlcmU=" \
    //biz.app365.com/bizweb/services/bizobjects/m56.Barcode/{id}?fields=station_name,barcodes
    curl --request GET \
    --header "Authorization: Basic YWRtaW46WW91ckFQSUtleUhlcmU=" \
    //biz.app365.com/bizweb/services/query/ilms.LmsOrder.selectForList/ \
    "o.name": 'lgh', "o.code": 'fff'/0,100

    保存数据

    保存整个对象的URL: //biz.app365.com/bizweb/services/bizobjects/m56.Barcode/,同时post一个json对象

    更新几个字段的URL://biz.app365.com/bizweb/services/bizobjects/m56.Barcode/{id},同时post一个json对象

    完整的请求举例:

    curl //biz.app365.com/bizweb/services/bizobjects/m56.Barcode/
    -H "Content-Type: application/json" -d @barcode.json
    -H "Authorization: Basic YWRtaW46WW91ckFQSUtleUhlcmU="

    服务响应

    APP365 API根据请求的结果,返回相应的HTTP状态代码。根据HTTP的规定,响应按照下列状态码性质被分成几大类。出错的响应中也同时包含了一个错误消息在响应的body中,你可以根据这个消息判断和解决问题。

    2xx 调用成功

    Code Definition Purpose
    200 OK For successful GET/PUT requests.
    201 Created For a successful POST request.
    202 Accepted For a request that resulted in a scheduled task being created to perform the actual request.
    204
    No Content
    For a successful request that produced no response (such as DELETE requests).

    3xx 重定向

    Code Definition Purpose
    301 Moved Permanently When the API routes have changed (unlikely) or if the incoming request is not secure (http) then it will be redirect to the secure (https) version.
    302
    Found
    When the resource was found at a different location. When a request to a deprecated version of the API is received, a 302 Found response will be issued to the current API version.
    304
    Not Modified
    If an If-Modified-Since header is sent in the request and the resource has not been modified since the specified date, then this response will be sent. NB. See resource specific pages for support for the If-Modified-Since header.

    4xx 客户端出错

    Code Definition Purpose
    400
    Bad Request
    Issued when a malformed request was sent. Such as due to invalid syntax or missing required data.
    401
    Unauthorized
    This response is sent when either the clients credentials are not provided or are incorrect.
    403
    Forbidden
    When the user doesn't have permission to perform a specific operation on a resource (eg. edit a product). Permissions can be set through the store control panel.
    404 Not Found When a particular resource doesn't exist or couldn't be found.
    405
    Method Not Allowed
    The resource was found, but doesn't support the request method. Issued when either a specific method isn't yet implemented on a resource, or the resource doesn't support the method at all (eg. PUT on /orders is invalid, but PUT on /orders/{id} is valid).
    406
    Not Acceptable
    When the client specifies a response content type in the Accept header that is not supported.
    409 Conflict A change requested by the client is being rejected due to a condition imposed by the server. The exact reasons response for this will vary from one resource to the next. Examples may include attempting to delete a Category which would result in Products being orphaned. Additional information about the conflict and how to resolve it may be available in the details section of the response.
    413
    Request Entity Too Large
    When the client requests too many objects. eg. the limit parameter was above the maximum allowed.
    415
    Unsupported Media Type
    When the client specifies a content type in the Content-Type header that is not supported by the API.

    5xx 服务端出错

    Code Definition Purpose
    500 Internal Server Error When an error has occurred within the API.
    501 Not Implemented When a request method is sent that is not supported by the API (eg. TRACE, PATCH).
    503
    Service Unavailable
    When the store is marked as "Down for Maintenance" or the store is being upgraded to a new version.
    507
    Insufficient Storage
    When the store has reached a limitation for the resource according to their BigCommerce plan (eg 500 product limit).
    509
    Bandwidth Limit Exceeded
    When the requests-per-hour limitations for the API have been reached.



  • 一起嗨起来!大国重器组团跳“机械舞” 2019-05-24
  • 楼市下半年或持续降温 房地产长效机制加速推进 2019-05-24
  • 今年江西千万元公益金买服务 受益者将更广泛 2019-05-23
  • 干细胞-热门标签-华商生活 2019-05-23
  • 网购陷阱多 女子花3000元买5套化妆品只有2套是真的 2019-05-22
  • 新华网评:凝聚打赢脱贫攻坚战的强大合力 2019-05-22
  • 广图:神“摄”手初养成计划:摄影师爸爸成长篇 2019-05-21
  • 神奇!这种纸能千年不腐 默默记录西藏 2019-05-20
  • 东西方坦克大赛PK 到底谁家的赛制更实战? 2019-05-20
  • 2月涉旅舆情生态云南旅游形象遭受重创亟待“救赎” 2019-05-19
  • 三位基层书记的一周:思想不转换 其他都白扯 2019-05-18
  • 异类非人思维。如一尼安德特人从2万年前发出的声音。 2019-05-17
  • 广东暴雨4人“疑似被电击”致死 市民上街提心吊胆 2019-05-16
  • 日本连续6次挺进世界杯 今晚首秀 2019-05-15
  • 为人民谋幸福的前进脚步——十九大报告中的民生看点 2019-05-14