[Python] Errors calling createinboundplan in python-amazon-sp-api

Discussão em 'Python' iniciado por Stack, Dezembro 19, 2024.

  1. Stack

    Stack Membro Participativo

    I'm totally stumped trying to migrate to the new SP API Inbound Fulfillment API at the first step (createInboundPlan). Here's the payload just before it's POSTed to /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": "paul@email.co.uk",
    "name": "Paul Anderson",
    "phoneNumber": "07841903333",
    "postalCode": "BT23 6QQ",
    "stateOrProvinceCode": "Co. Down"
    }
    },
    "path": "/inbound/fba/<version>/inboundPlans",
    "method": "POST"
    }


    It keeps failing with the following error, which I expect means I'm passing in my body data in the wrong format, but I can't see why. Anyone able to point me in the right direction, or show me a piece of working sample code?

    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': ''}]

    Continue reading...

Compartilhe esta Página