散装更新Shopify跟踪代码由REST API在Python中

发布于 2025-02-05 15:20:36 字数 1892 浏览 2 评论 0原文

我已经提到创建一个创建一个新的履行 shopify dev文档,但这只会给我<响应[400]>

,然后我尝试了此为一个或多个履行订单创建满足。 发送请求后,我得到了< wenspy [201]>,但是该顺序显示正在进行的而不是实现。此外,跟踪代码和跟踪公司也不会出现在商店中。

以下是我正在使用的代码。如何更新跟踪代码和公司。

Python Environment

import pandas as pd  
import numpy as np
from datetime import datetime, timedelta
import requests 
import json
from requests.structures import CaseInsensitiveDict
headers = CaseInsensitiveDict() 

API

# add parameter to headers
access_token = f'{token}'
headers["Content-Type"] = "application/json"
headers["X-Shopify-Access-Token"] = f"{access_token}"

身份验证邮政正文,用于跟踪代码/公司/URL信息

data = {}
data['fulfillment'] = {}
data['fulfillment']['tracking_info'] = {}
data['fulfillment']['location_id'] = f'{location_id}'  # location id
data['fulfillment']['notify_customer'] = False
data['fulfillment']['status'] = 'success'

data['fulfillment']['tracking_info']['tracking_number'] = f'{trackingCode}'
data['fulfillment']['tracking_info']['company'] = 'DHL Express'
data['fulfillment']['tracking_info']['tracking_urls'] = f'https://www.dhl.com/us-en/home/tracking/tracking-express.html?submit=1&tracking-id={trackingCode}'

发送POST请求

createFulfillment_url = f'{shop_url}/admin/api/2022-04/orders/{orderID}/fulfillments.json'
request.post(createFulfillment_url, headers = headers, json = data)

< wenspys [201]>,但是跟踪代码和公司不显示

I have referred to Create a new fulfillment Shopify dev documentation, but this will only gave me <Response [400]>

And I tried this one Creats a fulfillment for one or many fulfillment orders.
After sending the request, I got<Response [201]>, but the order shows in progress instead of fulfilled. Also the tracking code and the tracking company don't appear in the shop.

The following are the codes I was using. How can I update the tracking code and company.

Python Environment

import pandas as pd  
import numpy as np
from datetime import datetime, timedelta
import requests 
import json
from requests.structures import CaseInsensitiveDict
headers = CaseInsensitiveDict() 

API authentication

# add parameter to headers
access_token = f'{token}'
headers["Content-Type"] = "application/json"
headers["X-Shopify-Access-Token"] = f"{access_token}"

post body for tracking code/company/url information

data = {}
data['fulfillment'] = {}
data['fulfillment']['tracking_info'] = {}
data['fulfillment']['location_id'] = f'{location_id}'  # location id
data['fulfillment']['notify_customer'] = False
data['fulfillment']['status'] = 'success'

data['fulfillment']['tracking_info']['tracking_number'] = f'{trackingCode}'
data['fulfillment']['tracking_info']['company'] = 'DHL Express'
data['fulfillment']['tracking_info']['tracking_urls'] = f'https://www.dhl.com/us-en/home/tracking/tracking-express.html?submit=1&tracking-id={trackingCode}'

Send the post request

createFulfillment_url = f'{shop_url}/admin/api/2022-04/orders/{orderID}/fulfillments.json'
request.post(createFulfillment_url, headers = headers, json = data)

<Response [201]> but the tracking code and the company doesn't show

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文