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:
Are you specifying the correct server location?
Make sure that the server URL matches with the application's server location. If you are using the wrong URL, you will get a response with the HTTP status code "404 Not Found" and the
The English version of the Kii Cloud documentation assumes that you are using the US location, so you need to replace the URL in the samples if you are using other server location. You can check your application's server location on the application list that will appear right after you logs in the developer portal.
FYI, the English version uses
https://api.kii.comfor the US server location. The Japanese versions uses
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.
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
errorCodein the response is
INVALID_JSON, the format of the parameters might be in the wrong format.
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.