Invalid JSON in body

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
adityabanerjee
Posts: 44
Joined: 05 Oct 2019, 06:42

Invalid JSON in body

Post by adityabanerjee » 18 Dec 2019, 07:44

Hi guys,

I am trying to add a product to the basket from the postman. Now I have installed Laravel passport and passing the authorization in the headers and my URL with post method is -:

Code: Select all

http://ebdaa-ecommerce-beta.test/default/jsonapi/basket?id=default&related=product&product.id=15&quantity=1

Now in response, I am getting -:

"errors": [
{
"title": "Invalid JSON in body"
}
]

Any idea what I may be doing wrong? Please assist.

Thank you

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Invalid JSON in body

Post by aimeos » 19 Dec 2019, 07:04

Product ID, quantity, etc. must be passed in the JSON body, not as GET parameter:
https://aimeos.org/docs/Developers/Clie ... d_products

Code: Select all

{data: [{
    attributes: {
        "product.id": "<id>",
        "quantity": 1,
        "stocktype": "default",
        "variant": [],
        "config": {},
        "custom": {}
    }
}]}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply