【发布时间】:2021-05-02 06:33:14
【问题描述】:
我正在尝试通过来自 unicommerce.com 的 PHP 中的 rest API 获取销售订单。问题是我无法理解通过 API 从服务器获取数据的参数。 据我了解,我使用我的凭据从该页面成功地从服务器access-token 获取数据。 但由于参数很少,我试图获得sales-order,我无法理解我通过什么来获取数据。 仅显示要传递的数据的页面 -
基本信息
| NAME | DETAILS |
|---|---|
| Endpoint: | /services/rest/v1/oms/saleorder/get |
| Request Type: | POST |
| Level: | Tenant |
| Scheme: | HTTPS |
| Header (Content-Type): | application/json |
| Header (Authorization): | bearer {access-token}, Eg.: bearer b30f3aea-7978-49bb-9ea7-33eddfc80afa |
我是这样使用的,但它不起作用
并显示错误 - {"error":"unauthorized","error_description":"An Authentication object was not found in the SecurityContext"}
https://subdomain.unicommerce.com/services/rest/v1/oms/saleorder/get?bearer=b30f3aea-7978-49bb-9ea7-33eddfc80afa
【问题讨论】:
-
您包含的基本信息表显示
bearer旨在作为标题传递,而不是作为查询字符串的一部分。我浏览了您链接的文档,但看起来他们没有给出任何示例,但是这里有很多关于 SO,例如 stackoverflow.com/questions/30426047/… -
这能回答你的问题吗? Correct way to set Bearer token with CURL