Is it fine to get '204 No Content' in PATCH method

1.3K    Asked by BrianKennedy in Salesforce , Asked on Jul 17, 2021

 I am making a PATCH request to update a contact in Salesforce via API. The resource seems to be updated fine, but it returns me 204 No Content in POSTMAN. To my knowledge, it just means that there was no body returned in response which makes sense, since its PATCH method. But just wanted to confirm, Is it an error that I should be worried about?



Answered by Csaba Toth

Status code 204 means No Content does not mean an error code. It still reflects a successful operation. This is from the MDN docs: The common use case is to return 204 as a result of a PUT request, updating a resource, without changing the current content of the page displayed to the user. Additionally, Status Codes and Error Responses documentation lists the different status codes that are used in Salesforce REST API Contexts. Irrespective of the context where it is used, the status code 204 is always a successful response.



Your Answer

Interviews

Parent Categories