JSON troubleshooting: how to fix the 400 error?
How to check what error I got?
To see the details of an error you received, click "View more" on the error notification after the importer was executed:
How to fix the error I got?
400 - Bad Request error
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
This error occurs when there is a mistake in the used parameters of the API: URL, query parameters, body attribute names, or values. The most common issues include:
- Invalid parameter value
Example:GET https://api.hubapi.com/crm/v3/owners?hapikey=KEY&limit=100000
Execution error:
This error indicates that the "limit" parameter can be equal to 500 as a maximum, so you can update your request and use an https://api.hubapi.com/crm/v3/owners?hapikey=KEY&limit=500
API request.
- Issues with POST body: missed body, wrong structure, wrong values
Coupler.io supports the body for POST requests in YAML format. To get the body in the correct format, please follow these steps:1. Read the documentation of the API that you are using and find the proper example of the request you need, e.g.:
- WooCommerce API docs
- Facebook Marketing APIs Reference
- Yahoo Finance API2. Try to build the request in the Postman or any other REST API client.
3. Copy the body and paste it to the JSON to YAML converter: https://www.json2yaml.com/.
4. Use this YAML as a body in the Coupler.io importer.
Execution errors that occur due to issues with POST body:
Example 1 - the invalid value of an attribute:
Execution error:
This error indicates that empty value "" is not allowed for the "value" attribute used in the body. Usage of any string value will make this body valid: Example 2 - the invalid structure of POST body: Execution error:
This error indicates that some attributes are missing, so the body is not full. To fix it, please make sure that you use the correct YAML structure, as described in the steps above.
Example 3 - missing body:
Execution error:
This error indicates that the body is missing. To fix it, please make sure that you use the correct YAML structure, as described in the steps above.
If you faced an error and cannot fix it after reading this article, feel free to contact our support at contact@coupler.io.