如何使eBay的BulkMigrateListing()API调用起作用

时间:2018-07-18 08:59:55

标签: ebay-api

我正在尝试使用PostMan使用呼叫BulkMigrateListing将eBay列表迁移到eBay MIP NG。

在PostMan中,C#调用为:

var client = new RestClient("https://api.ebay.com/sell/inventory/v1/bulk_migrate_listing");
var request = new RestRequest(Method.POST);

request.AddHeader("Postman-Token", "c6a6a651-6412-4fc6-94fb-4459883e69e5");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Authorization", "Bearer The-User-OAuth-Token");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "JSON-String", ParameterType.RequestBody);

IRestResponse response = client.Execute(request);

其中JSON-String是:

{ 
    "requests" : 
    [
        { "listingId" : "123456...." }
    ]
}

The-User-OAuth-Token是来自eBay开发人员帐户的经过适当授权的令牌。

但是我在PostMan中得到的答复是:

{
  "errors": [
    {
      "errorId": 25001,
      "domain": "API_INVENTORY",
      "subdomain": "Selling",
      "category": "SYSTEM",
      "message": "A system error has occurred."
    }
  ]
}

有人成功致电BulkMigrateListing吗?我在做什么错了?

1 个答案:

答案 0 :(得分:0)

这是我到目前为止所发现的:

BulkMigrateListing()非常好用。根据经验,响应。内容可能是

public class Template extends Region {

  /**
   * Sets the main content.
   */
  private Node content;
  public void addContent(Node content) {
    if (this.content != null) {
      getChildren().remove(this.content);
    }
    if (content!= null) {
      getChildren().add(content);

      // Bind size to the content if it is a resizable node.
      if (content instanceof Region) {
        prefWidthProperty().bind(((Region) content).widthProperty());
        prefHeightProperty().bind(((Region) content).heightProperty());
        // Min and max size as well...
      } else if (content instanceof WebView) {
        prefWidthProperty().bind(((WebView) content).widthProperty());
        prefHeightProperty().bind(((WebView) content).heightProperty());
        // ...
      }
    }
  }
  public void getContent() {
    return content;
  }

  @Override
  protected void layoutChildren() {
    super.layoutChildren();
    final Node content = getContent();

    // Layout containers automatically fill the entire root (or if it is a resizable node like WebView)
    if (content instanceof Region || content instanceof WebView) {
      content.resize(getWidth(), getHeight());
    }
  }
}

如果呼叫正常,则返回#4或#1。

一种检查方法是致电https://api.ebay.com/sell/inventory/v1/inventory_item/THE-USER-SKU

返回的数据可能是:

1. {"errors":[{"errorId":25001,"domain":"API_INVENTORY","subdomain":"Selling","category":"SYSTEM","message":"A system error has occurred."}]}

2. {"errors":[{"errorId": 1001,"domain": "OAuth","category": "REQUEST","message": "Invalid access token","longMessage": "Invalid access token. Check the value of the Authorization HTTP request header."}]}

3. Missing token message

4. {"responses": [{"statusCode": 200,"listingId": "123412958208","marketplaceId": "EBAY_DE","inventoryItems": [{"sku": "ABC-004","offerId": "12347167010"}]}]}

如果产品已迁移到MIP NG,则返回#1,否则返回#2。