Error handling

A successful API call will return an HTTP status code of 200. However, your code should also handle potential errors. The most common error is a BadWords, which occurs when you call convert-to-coordinates with an invalid 3 word address. In this case, you will get the appropriate HTTP error status (400 in this case). Also, the body will contain an error block with a code and a message. code can be used programmatically so you can respond appropriately. message is intended as a helpful message to help you understand what went wrong.

Example error

URL: https://what3words.search.hereapi.com/v3/convert-to-coordinates?words=no.address.here&key=[API-KEY]

The response will be an HTTP 400, with the following body:

JSON

{
  "error": {
      "code": "BadWords",
      "message": "Invalid or non-existent 3 word address"
  }
}

Below is a list of all HTTP error codes. This is not an exhaustive list; new error codes may be added in future.

Code Description
200 Successful
400 Bad request. This could be caused by: (1) Invalid character: make sure you URL encode all parameters. (2) Bad parameter: the code will be set to, for example, BadWords, BadCoordinates, BadLanguage, BadFormat, BadClipToPolygon and so on. (3) Missing parameter: a required parameter was missing. For example MissingWords, MissingInput or MissingBoundingBox. (4) Duplicate parameter: a parameter must only be specified once. If not, you will see a DuplicateParameter error code.
401 MissingKey or InvalidKey. Check you API key is supplied as key=[API-KEY]. If not supplied as a parameter, a key must be supplied as a request header X-API-KEY.
404 URL not found. Check the URL of the endpoint you're trying to reach.
405 Method not allowed. You must use a GET request.
50x Internal Server Error.

results matching ""

    No results matching ""