Hi everyone,
I'd like to know how can I publish an existing product via the REST API.
I've tried to send something like that :
{
"product": {
"id": xxxxxxxxxxx,
"published": true
}
}
But I keep getting a 400 Bad Request.
Solved! Go to the solution
This is an accepted solution.
Hi
We'll need a little more information than this if possible.
What's the endpoint you're hitting?
What method is the request? (i.e. GET, POST, PUT etc.)
Are you sending the data in your post as the body of a POST request?
I believe for this kind of update you'll want to PUT to an endpoint that includes the product ID in the URL:
// PUT /admin/api/2020-07/products/xxxxxxxxxxx.json
{
"product": {
"id": xxxxxxxxxxx,
"published": true
}
}
Hi Nicolas
So a 406 normally means some kind of misformed request.
Do you have the full headers object for the request?
How are you making the request?
Would you be able to share the code for how you're making the request?
Do the keys your using have the correct Product Write permissions?
Sorry hard to know exactly what to tell you unless we get a bit more info.
User | Count |
---|---|
13 | |
12 | |
10 | |
8 | |
8 |