The PUT method allows you to update existing objects in the system by sending your changes to a specific URL that references the object.
To update an object, send a PUT HTTP request to the URL that refers to the specific object you want to modify. The data must be submitted as a JSON array of keys and values for the object fields.
Content-Type
must be declared and set to application/json
, otherwise the default text/plain
is assumed and the request will fail.
Update the name of the product with ID 1:
curl --user admin@example.com:APIkey --header 'Content-Type: application/json' -d '{"product": "New Product Name"}' -X PUT 'https://www.venddor.com.br/api/products/1'
{ "product": "New Product Name" }
After a successful update, the API will return the ID of the updated object:
{ "product_id": "1" }
Status Code | Description |
---|---|
200 OK |
The object was updated successfully |
400 Bad Request |
Invalid request format or parameters |
401 Unauthorized |
Authentication required or failed |
403 Forbidden |
You don't have permission to update this object |
404 Not Found |
The requested object doesn't exist |