简体   繁体   English

如何使用python中的REST API在shopify中获取具有发货状态的所有订单?

[英]How to get all the orders in shopify with fulfillment status as shipped using REST API in python?

I am trying to get all the orders on a shopify store which have the fulfillment status as shipped.我正在尝试获取 Shopify 商店中的所有订单,这些订单的履行状态为已发货。

When I use the following in the web browser url, I am able to get the desired results:当我在 Web 浏览器 url 中使用以下内容时,我能够获得所需的结果:

https://<store_name>.myshopify.com/admin/api/2020-01/orders/search.json?query=fulfillment_status:shipped

However, when I try to use the following piece of python (Python 3.8.2) code, the json returned is empty.但是,当我尝试使用以下 Python(Python 3.8.2)代码时,返回的 json 为空。 What am I missing?我错过了什么?

>>> payload = {'fulfillment_status':'shipped', 'limit':100}
>>> response = requests.get( "https://%s.myshopify.com/admin/api/2020-01/orders.json" % (SHOP_NAME), auth=(API_KEY,PASSWORD), params=payload)
>>> response
<Response [200]>
>>> response.json()
{'orders': []}

Try by using the following URL:尝试使用以下 URL:

url = "https://{apikey}:{password}@{hostname}/admin/api/{version}/{resource}.json?limit=250&fulfillment_status=shipped"
response = requests.request("GET", url)

There is a tutorial on how you can get all orders from Shopify, you may find it useful:有一个关于如何从 Shopify 获取所有订单的教程,您可能会发现它很有用:

https://predictivehacks.com/how-to-get-all-orders-from-shopify-in-python/ https://predictivehacks.com/how-to-get-all-orders-from-shopify-in-python/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Python 和 REST API 将图片上传到 Shopify - Upload image to Shopify using Python and REST API 如何从 Shopify Python API 获取所有客户数据? - How to get all customers data from Shopify Python API? 如何从 bigcommerce api 获取所有订单 - How to get ALL orders from bigcommerce api 如何使用 Python 从 Shopify API 中仅提取“昨天的”订单。 需要是动态的,而不是静态的 - How can I pull only 'yesterday's' orders from Shopify API using Python. Needs to be dynamic, not static Shopify API 订单数据 - Shopify API orders data 我可以通过 python API 获取 Dialogflow CX 中的所有 Route Fulfillment 消息吗? - Can I get all Route Fulfillment messages in Dialogflow CX by python API? Shopify API:如何向客户发送有关产品正在发货的电子邮件? - Shopify API: How do I send customer an email about product being shipped? 无法使用 rest api 和 python 获取并发布到 alm。 总是收到 401 状态码 - Not able to get and post to alm using rest api and python. Always getting 401 status code Shopify API 订单在几次 POST 请求后抛出 429 状态代码(请求过多) - Shopify API Orders throws 429 status code (too many requests) after few POST request 如何在 python 中使用 discord api 获取用户活动和状态 - How to get users activity and status using discord api in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM