Create new resource items Postman

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!
CairMK
Posts: 5
Joined: 25 Dec 2020, 07:52

Create new resource items Postman

Post by CairMK » 12 Jan 2021, 10:27

Hi all trying to add a new product using postman, my postman request is:
image 1 auth with laravel passport token
Image
second image json body
Image

what I'm doing wrong pls help

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

Re: Create new resource items Postman

Post by aimeos » 13 Jan 2021, 09:17

The JSON REST API is only for the frontend and doesn't allow managing products. You need to use the JsonAdm API for managing products:
https://aimeos.org/docs/latest/admin/jsonadm/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

CairMK
Posts: 5
Joined: 25 Dec 2020, 07:52

Re: Create new resource items Postman

Post by CairMK » 13 Jan 2021, 09:49

I have changed the URL in postman but still not working no error no info according to the doc how I understand,
the URL is http://localhost:8000/jsonadm/default/product method is post and in the body we need
{
"data": {
"type": "product",
"attributes": {
"product.code": "test",
"product.label": "Test product",
"product.status": "0"
}
}
}
the token need to be pass in the URL as well or just using postman in the header pls give me an example in postman

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

Re: Create new resource items Postman

Post by aimeos » 13 Jan 2021, 10:40

Don't know Postman but CURL should be similar. Here's the excerpt from the docs:

Code: Select all

curl -b cookies.txt -c cookies.txt \
-X POST 'http://localhost:8000/jsonadm/default/product?_token=...' \
-H 'Content-Type: application/json' \
-d '{"data": {
    "type": "product",
    "attributes": {
        "product.code": "test",
        "product.label": "Test product",
        "product.status": "0"
    }
}}'
Make sure you are logged in with an admin account and you pass the Laravel session cookie along with the request.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply