To find an error cause, check an error message in the response and the messages recorded in the developer log. Please also check the following points:

  1. Does the HTTP method match?

    Using the wrong HTTP method might cause some hard-to-detect errors.

    The method (e.g., GET, POST, PUT, and DELETE) of the REST API is fixed for the specific feature, so using the wrong method could execute the wrong feature. If you specify an undefined method, you will get the HTTP Status Code "405 Method Not Allowed" so you will instantly know that you've used the wrong method.

    If you specify the wrong method and this method is supported by the API, it could be hard to spot this mistake because the returned status code is not fixed. For example, you will get the HTTP Status Code "415 Unsupported Media Type" if you've specified the wrong method and this method only supports the specific Content-Type. Please check the sample code and REST API documents carefully to confirm that you are using the correct method.

    Also, make sure that the method name is all capital letters.

  2. Are the parameters sent as JSON when calling from your code?

    Make sure that you are sending the parameters correctly when you are executing the POST and PUT methods from your code. If you are getting the HTTP status code "400 Bad Request" and the errorCode in the response is INVALID_JSON, the format of the parameters might be in the wrong format.

    If you are calling the REST API in JavaScript code, for example, you can use the jQuery as shown in the server code sample. In this case, you need to format the parameter with the JSON.stringify() as presented in the sample, or you will get the "400 Bad Request" error.

    The same precaution applies when you are calling the REST API from other languages.