Pim-community-dev: API - PATCH product content type

Created on 30 Mar 2017  ·  3Comments  ·  Source: akeneo/pim-community-dev

I'm reporting a Bug

Just updated to latest official 1.7 community.

API access is working, I can list and create products.
Using the PATHC method to update products I'm getting an error about the content type. Sending

PATCH /api/rest/v1/products HTTP/1.1
Host: myakeneo.test.it
Content-Type: application/json
Authorization: Bearer YjFkODg2MDRmNTgyNWE2Zjg4YjliMWE5MWI4ZDk1ODU5YjFjZjA1OGQ3MzA5Nzg3ZGNlM2ZlNDkxOWViOTI0YQ
Cache-Control: no-cache
Postman-Token: 2574016d-6a4f-efe1-0167-4f0cbfd547b8

{
"identifier": "testblu",
"enabled": true,
"family": null,
"categories": [
"originali_as400"
],
"groups": [],
"variant_group": null,
"values": {
"nome_articolo": [
{
"data": "test blu it as",
"locale": "it_IT",
"scope": "as400"
},
{
"data": "test blu it b2b",
"locale": "it_IT",
"scope": "acme_b2b"
}
]
},
"associations": []
}

I'm getting the error

{
"code": 415,
"message": "\"application/json\" in \"Content-Type\" header is not valid. Only \"application/vnd.akeneo.collection+json\" is allowed."
}

Trying with the reported "application/vnd.akeneo.collection+json" I get only "Syntax error"

Most helpful comment

Thanks to all, sorry for the wrong report.

All 3 comments

'+' sign?

The route used to update à single product is not the good one. In your example, the route is used to update multiple products in one request (this route use a specific content).

If you want to update one product by request, please add the identifier at the end if your route.

/api/rest/v1/products/{identifier}

Thanks to all, sorry for the wrong report.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

henryktews picture henryktews  ·  4Comments

nowiko picture nowiko  ·  6Comments

pardahlman picture pardahlman  ·  4Comments

lpxavi picture lpxavi  ·  4Comments

ewallteam picture ewallteam  ·  6Comments