在 python-amazon-sp-api 中调用 createinboundplan 时出错

问题描述 投票:0回答:1

我在第一步(createInboundPlan)尝试迁移到新的 SP API Inbound Fulfillment API 时完全被难住了。 这是发布到 /inboundPlans 之前的有效负载

  "body": {
    "destinationMarketplaces": [
      "A1F83G8C2ARO7P"
    ],
    "items": [
      {
        "labelOwner": "SELLER",
        "msku": "GNT~300506-9-10~RubiesDisneyFroze",
        "prepOwner": "SELLER",
        "quantity": 24
      },
      {
        "labelOwner": "SELLER",
        "msku": "GNT~6061626~SpinMasterGamesSkillm",
        "prepOwner": "SELLER",
        "quantity": 8
      },
      {
        "labelOwner": "SELLER",
        "msku": "GNT~F2934~MyLittlePonyPlayDoh",
        "prepOwner": "SELLER",
        "quantity": 24
      },
      {
        "labelOwner": "SELLER",
        "msku": "GNT~HKV33~PollyPocketMiniToysCampAdve",
        "prepOwner": "SELLER",
        "quantity": 32
      },
      {
        "labelOwner": "SELLER",
        "msku": "GNT~TM15537~McFarlaneToysDCMultiverse",
        "prepOwner": "SELLER",
        "quantity": 6
      },
      {
        "labelOwner": "SELLER",
        "msku": "SMF~70604~Playmobil70596CityLifeF",
        "prepOwner": "SELLER",
        "quantity": 24
      }
    ],
    "name": "TEST",
    "sourceAddress": {
      "addressLine1": "Unit 2 49 Quarry Road",
      "addressLine2": "Ballydrain",
      "city": "Lisbane",
      "companyName": "Ardmillan Trading Limited",
      "countryCode": "GB",
      "email": "[email protected]",
      "name": "Paul Anderson",
      "phoneNumber": "07841903333",
      "postalCode": "BT23 6QQ",
      "stateOrProvinceCode": "Co. Down"
    }
  },
  "path": "/inbound/fba/<version>/inboundPlans",
  "method": "POST"
}

它不断失败并出现以下错误,我希望这意味着我以错误的格式传递了我的身体数据,但我不明白为什么。 任何人都可以为我指出正确的方向,或者向我展示一段工作示例代码?

sp_api.base.exceptions.SellingApiBadRequestException: [{'code': 'InvalidInput', 'message': "9 validation errors detected: Value '[]' at 'request.destinationMarketplaces' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'request.sourceAddress.phoneNumber' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'request.sourceAddress.city' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'request.sourceAddress.countryCode' failed to satisfy constraint: Member must satisfy regular expression pattern: [A-Z]{2}; Value at 'request.sourceAddress.countryCode' failed to satisfy constraint: Member must have length greater than or equal to 2; Value at 'request.sourceAddress.postalCode' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'request.sourceAddress.name' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'request.sourceAddress.addressLine1' failed to satisfy constraint: Member must have length greater than or equal to 1; Value '[]' at 'request.items' failed to satisfy constraint: Member must have length greater than or equal to 1", 'details': ''}]
python amazon
1个回答
0
投票

我在您发布的数据中看到

body.sourceAddress
, 它有一个非常好的 2 个字符
GB
国家/地区代码。

我在您发布的内容中没有看到

request.sourceAddress.countryCode
。 对于
postalCode
和其他地址详细信息也是如此 诊断中提到。

这是一条诊断错误消息。 它试图帮助您了解出了什么问题以及如何补救。 阅读它。 遵循其指示。 提供它建议的字段。

© www.soinside.com 2019 - 2024. All rights reserved.