![](/img/trans.png)
[英]How to get all the orders in shopify with fulfillment status as shipped using REST API in python?
[英]How to get ALL orders from bigcommerce api
我正在尝试从此处的订单 V2 中检索来自 bigcommerce API 的所有订单: https ://developer.bigcommerce.com/api-reference/e898c792ecd41-orders-v2 但我收到403 error
。
这就是我正在做的事情:
store_hash = os.environ.get("store_harsh")
headers= {
"Accept": "application/json",
"Content-Type": "application/json",
"X-Auth-Token": access_token,
}
url = f"https://api.bigcommerce.com/stores/{store_hash}/v2/orders"
orders = requests.get(url, headers=headers)
这是完整的错误:
{
"status": 403,
"title": "You don't have a required scope to access the endpoint",
"type": "https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes",
"errors": {}
}
我尝试在标题中指定范围,但仍然遇到相同的错误。 我非常感谢你的时间
API 说您的 API Key 没有访问订单所需的权限,请尝试重新生成新的 API Key 并重新提交。
为了扩展我之前的答案,这里是我用来与 bigcommerce 交互的工作 Python 代码(我看到你正在使用它)。
class BigCommerce:
"""
Adaptor to communicate with bigcommerce to give us access to all functionality we require.
"""
@newrelic.agent.background_task()
def __init__(self, store_hash, client_id, token):
self.store_hash = store_hash
self.client_id = client_id
self.token = token
self.result = None
self.base_url = "https://api.bigcommerce.com/stores/{}/v3/".format(self.store_hash)
self.header = {
"X-Auth-Client": self.client_id,
"X-Auth-Token": self.token,
"Content-Type": "application/json",
"Accept": "application/json",
}
注意我那里有client_id
和token
。 您需要这两项才能正确进行身份验证。
我使用v3
端点的事实应该无关紧要。
另外 - 当我调用 API 时,这是代码:
request = requests.get(full_path, headers=self.header)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.