Screenshot Postman post request
I have been experiencing difficulties for a few days with the following issue:
I am trying to create a new product via the Admin API using Postman. Unfortunately, the server responds with a list of all products instead of adding the new product.
I have created the request according to the Shopware Admin API documentation:
Url: POST "http://shop.de/api/product" Parameters: Accept: application/json, Content-Type: application/json
Body:
{
"name": "test",
"productNumber": "random",
"stock": 10,
"taxId": "a5da76b447db4d0aba62e6512dadf45b",
"price": [
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"gross": 15,
"net": 10,
"linked": false
}
]
}
I have taken the values for taxId and currencyId from existing products. Could the issue be with the URL endpoint or somewhere else? I would appreciate any help!
Best regards,
Sevki
I tried to post a new product using the Shopware Admin API with Postman, but the server responds with a list of all products instead of creating a new product.
Everything about your request is completely correct.
If you receive a product list from http://shop.tld/api/product
you have used the request type GET
instead of POST
.
I have double checked it in a local installation.
POST will create your product:
GET will get you a list of all products:
A common reason for accidental use of GET is a redirect from http://
to https://
or from non-www.
to www.
. You might want to check for that.