管理你的商店

注意

Microsoft Store 资源仅对封闭 Beta 版参与者可用。 有关参与封闭 beta 或开放 beta 计划的信息,请联系你的客户经理。

在 beta 版期间,所有 Store 编程元素和文档都可能会更改。

若要创建存储,请使用 POST 存储模板。 POST 的正文是 StoreCreate 对象。 必须指定 storeNamestoreDestinationUrlnotificationEmail 字段。 其他字段是可选的。 必须事先 验证并声明了网站的 URL

下面显示了一个仅指定必填字段的示例请求。

curl -X POST -H "AuthenticationToken: <access token goes here>" -H "DeveloperToken: <developer token goes here>" -H "Content-Type: application/json" --data "{\"storeName\": \"Contoso Sports\",\"storeUrl\": \"https://contoso.com\",\"notificationEmail\": [\"someone@example.com\"]}"  https://content.api.ads.microsoft.com/v9.1/bmc/stores

如果请求成功,响应的正文将包含 一个 Store 对象。 对象包含你在请求中指定的字段以及提供默认值的所有可选字段。 字段 merchantId 包含新存储的 ID,字段 storeStatus 指示是否已批准存储。

{
  "merchantId": 123456,
  "storeName": "Contoso Sports",
  "storeUrl": "https://contoso.com/",
  "notificationEmail": [
    "someone@example.com"
  ],
  "notificationLanguage": "en-US",
  "isSslCheckout": true,
  "isBlockAggregator": false,
  "storeStatus": {
    "status": "Approved"
  }
}

如果状态为“已批准”, StoreStatus 对象将包含 message 字段,该字段指示存储未获批准的原因。 在以下示例中,由于 为 false,因此该存储被isSslCheckout拒登。

  "storeStatus": {
    "status": "Disapproved",
    "message": "UnSecuredCheckOut"
  }

如果 POST 请求未通过验证,则响应正文是 ErrorResponse 对象。 有关可能错误代码的列表,请参阅 错误代码

{
  "errors": [
    {
      "code": "DuplicateStoreNameErr",
      "message": "Another store with the specified store name exists; store names must be unique with Microsoft Merchant Center."
    },
    {
      "code": "NotificationLanguageNotSupportedErr",
      "message": "The market that you specified in the notificationLanguage field is not valid."
    }
  ]
}

获取存储列表

若要获取用户有权访问的存储的列表,请使用 GET 存储模板。 如果你是代理机构,请包括 CustomerIdCustomerAccountId标头

curl -H "AuthenticationToken: <access token goes here>" -H "DeveloperToken: <developer token goes here>"  https://content.api.ads.microsoft.com/v9.1/bmc/stores

响应是一个 StoreCollection 对象。 字段 stores 包含 Store 对象的数组。

{
  "stores": [
    {
      "merchantId": 12345,
      "storeName": "Alpine Ski House",
      "storeUrl": "https://alpineskihouse.com/",
      "notificationEmail": [
        "someone@alpineskihouse.com"],
      "notificationLanguage": "de-De",
      "isSslCheckout": true,
      "isBlockAggregator": false,
      "storeStatus": {
        "status": "Approved"
      }
    },

    . . .

    {
      "merchantId": 67890,
      "storeName": "Fabrikam",
      "storeUrl": "https://fabrikam.com/",
      "notificationEmail": [
        "someone@fabrikam.com"],
      "notificationLanguage": "en-us",
      "isSslCheckout": true,
      "isBlockAggregator": false,
      "storeStatus": {
        "status": "Approved"
      }
    }
  ]
}

获取特定存储

若要获取用户有权访问的特定存储,请使用 GET 存储模板。 如果你是代理机构,请包括 CustomerIdCustomerAccountId标头

curl -H "AuthenticationToken: <access token goes here>" -H "DeveloperToken: <developer token goes here>"  https://content.api.ads.microsoft.com/v9.1/bmc/stores/12345

响应是一个 Store 对象。

{
  "merchantId": 12345,
  "storeName": "Alpine Ski House",
  "storeUrl": "http://www.alpineskihouse.com",
  "notificationEmail": [
    "someone@alpineskihouse.com"],
  "notificationLanguage": "de-DE",
  "isSslCheckout": true,
  "isBlockAggregator": false,
  "storeStatus": {
    "status": "Approved"
  }
}