如何通过 eBay api 从 eBay 沙箱获取跟踪号码?

发布于 2024-11-19 00:24:11 字数 65 浏览 2 评论 0原文

eBay 交易 API 不会提供跟踪号码来响应在 eBay 沙盒上销售的商品。该商品在 eBay 沙盒上有追踪号码。

The ebay trading api is not giving the tracking number in response for an item sold on ebay sandbox. The item has a tracking number on ebay sandbox.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

江南烟雨〆相思醉 2024-11-26 00:24:11

您还可以将 getorders API 与 eBay 结合使用。将需要该帐户的用户令牌,然后使用 ShippingDetails 响应。

http://developer.ebay.com/devzone/xml/docs /reference/ebay/GetOrders.html

You can also use the getorders API with eBay. Will require user token for that account and then use ShippingDetails response.

http://developer.ebay.com/devzone/xml/docs/reference/ebay/GetOrders.html

酒浓于脸红 2024-11-26 00:24:11

您需要使用:交易 API 中的 ShipmentTrackingDetailsType

可用的操作有:CompleteSale、GetItemTransactions、GetOrders、GetOrderTransactions、GetSellerTransactions、 GetSellingManagerSaleRecord(记录在同一页上)

You need to use: ShipmentTrackingDetailsType in Trading API

And the operations which have this available are: CompleteSale, GetItemTransactions, GetOrders, GetOrderTransactions, GetSellerTransactions, GetSellingManagerSaleRecord (documented on the same page)

海的爱人是光 2024-11-26 00:24:11

您可以使用 GetItemTransactions API

这是一个示例我在 Python 中为此创建的函数的

def get_item_transactions(item_id):
    ebay_user_token = os.getenv('EBAY_USER_TOKEN')
    url = 'https://api.ebay.com/ws/api.dll'
    headers = {
        'X-EBAY-API-SITEID': '0',
        'X-EBAY-API-COMPATIBILITY-LEVEL': '967',
        'X-EBAY-API-CALL-NAME': 'GetItemTransactions',
        'X-EBAY-API-IAF-TOKEN': ebay_user_token,
        'Content-Type': 'text/xml'
    }
    body = f'''<?xml version="1.0" encoding="utf-8"?>
    <GetItemTransactionsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
        <eBayAuthToken>{ebay_user_token}</eBayAuthToken>
    </RequesterCredentials>
    <ItemID>{item_id}</ItemID>
    <DetailLevel>ReturnAll</DetailLevel>
    <OutputSelector>ShippedTime</OutputSelector>
    <OutputSelector>ShippingDetails.ShipmentTrackingDetails.ShipmentTrackingNumber</OutputSelector>
    <OutputSelector>Buyer.FeedbackScore</OutputSelector>
    <OutputSelector>Seller.FeedbackScore</OutputSelector>
    <OutputSelector>ShippingDetails.ShippingServiceOptions.ShippingPackageInfo.ActualDeliveryTime</OutputSelector>
    <OutputSelector>ShippingDetails.ShippingServiceSelected.EstimatedDeliveryTimeMax</OutputSelector>
    <OutputSelector>ShippingDetails.ShippingServiceSelected.EstimatedDeliveryTimeMin</OutputSelector>
    <OutputSelector>ContainingOrder.OrderID</OutputSelector>
    <OutputSelector>Seller.UserID</OutputSelector>
    <OutputSelector>TransactionArray.Transaction.ActualShippingCost</OutputSelector>
    <Pagination>
        <EntriesPerPage>10</EntriesPerPage>
        <PageNumber>1</PageNumber>
    </Pagination>
    </GetItemTransactionsRequest>'''

    response = requests.post(url, headers=headers, data=body)
    response.raise_for_status()
    return response.text

您可以指定您想要的任何 OutputSelector,如链接的 API 文档中所述。当然,您可以迭代地获取这些详细信息并处理从任何其他端点收到的多个订单,例如您已售出的商品。

You can use the GetItemTransactions API

Here is an example of a function I created for doing this in Python

def get_item_transactions(item_id):
    ebay_user_token = os.getenv('EBAY_USER_TOKEN')
    url = 'https://api.ebay.com/ws/api.dll'
    headers = {
        'X-EBAY-API-SITEID': '0',
        'X-EBAY-API-COMPATIBILITY-LEVEL': '967',
        'X-EBAY-API-CALL-NAME': 'GetItemTransactions',
        'X-EBAY-API-IAF-TOKEN': ebay_user_token,
        'Content-Type': 'text/xml'
    }
    body = f'''<?xml version="1.0" encoding="utf-8"?>
    <GetItemTransactionsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
        <eBayAuthToken>{ebay_user_token}</eBayAuthToken>
    </RequesterCredentials>
    <ItemID>{item_id}</ItemID>
    <DetailLevel>ReturnAll</DetailLevel>
    <OutputSelector>ShippedTime</OutputSelector>
    <OutputSelector>ShippingDetails.ShipmentTrackingDetails.ShipmentTrackingNumber</OutputSelector>
    <OutputSelector>Buyer.FeedbackScore</OutputSelector>
    <OutputSelector>Seller.FeedbackScore</OutputSelector>
    <OutputSelector>ShippingDetails.ShippingServiceOptions.ShippingPackageInfo.ActualDeliveryTime</OutputSelector>
    <OutputSelector>ShippingDetails.ShippingServiceSelected.EstimatedDeliveryTimeMax</OutputSelector>
    <OutputSelector>ShippingDetails.ShippingServiceSelected.EstimatedDeliveryTimeMin</OutputSelector>
    <OutputSelector>ContainingOrder.OrderID</OutputSelector>
    <OutputSelector>Seller.UserID</OutputSelector>
    <OutputSelector>TransactionArray.Transaction.ActualShippingCost</OutputSelector>
    <Pagination>
        <EntriesPerPage>10</EntriesPerPage>
        <PageNumber>1</PageNumber>
    </Pagination>
    </GetItemTransactionsRequest>'''

    response = requests.post(url, headers=headers, data=body)
    response.raise_for_status()
    return response.text

You can specify whatever OutputSelector(s) you want as described in the linked API docs. Naturally, you can iteratively get these details and process multiple orders you receive from any other endpoint, such as your sold items.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文