Search code examples
web-servicesprestashop

parameter id_country require prestashop webservice


I try to create address of prestashop using webservice, but even though I put the id_country to some value it still return parameter \"id_country\" required. I am using Prestashop 1.7.8.9.

Body I request using this route {{webservice_url}}/api/addresses?output_format=JSON

    "address": {
        "id": 9,
        "id_customer": "0",
        "id_manufacturer": "0",
        "id_supplier": "1",
        "id_warehouse": "0",
        "id_country": "8",
        "id_state": "35",
        "alias": "supplier",
        "company": "Fashion",
        "lastname": "supplier",
        "firstname": "supplier",
        "vat_number": "",
        "address1": "767 Fifth Ave.",
        "address2": "",
        "postcode": "10153",
        "city": "New York",
        "other": "",
        "phone": "(212) 336-1440",
        "phone_mobile": "",
        "dni": "",
        "deleted": "0",
        "date_add": "2023-08-11 07:50:47",
        "date_upd": "2023-08-11 07:50:47"
    }
}

Solution

  • As per official documentation Prestashop webservices is only able to output JSON, it cannot read JSON inputs.

    See: https://devdocs.prestashop-project.org/8/webservice/getting-started/

    Try rewriting your input in XML and it should work correctly - Data looks good to me.