Create a HTTPS request

To perform an operation, make a HTTPS request that specifies the URL for the endpoint, along with the headers, method, request body, and query parameters.

The following example contains the values used to create a new location.

  1. Specify the resource URL
  2. Specify the method
  3. Set the header
  4. Create the request body
  5. Specify the query parameters
  6. Check the reponse

Specify the resource URL

You access a resource with its URL. See the URLs for each resource in the reference docs.

In this example, the first line of the cURL command specifies the URL:

curl -i -X POST \
    https://api.whosonlocation.com/v1/location \

Specify the HTTP method

Specify a HTTP method to perform an action on a resource:

  • GET to list one or all resources
  • POST to create
  • PUT to update
  • DELETE to delete

In the following example, the call is creating a customer and uses the POST method:

curl -i -X POST \
  https://api.whosonlocation.com/v1/location \
  -H 'Content-Type: application/json' \

Set the headers

You use HTTP headers to specify additional information about the call.

The following example has two headers: Authorization contains the API key, which provides the credentials for the call. Content type specifies the type of data application/json

  curl -i -X POST \
    https://api.whosonlocation.com/v1/location \
    -H 'Content-Type: application/json' \
    -H 'Authorization: APIKEY abcdef1234567890' \

Create the request body

In the example below, the request body contains the values used to update the location details:

  curl -i -X POST \
    https://api.whosonlocation.com/v1/location \
    -H 'Content-Type: application/json' \
    -H 'Authorization: APIKEY abcdef1234567890' \
    -d '{
      "name": "Head Office",
      "address": " 1008 Smith Terrace, Tawa, Wellington, New Zealand",
      "phone": "0212143956",
      "postcode": "5021",
      "country": "NZ",
      "timezone": "Pacific/Auckland",
      "date_format": "d/m/Y"
    }'

Specify any query parameters

Query parameters are used to filter, sort, or paginate list operations.

In the example below, the list of locations returned is filtered by locations with more than 200 employees and limited to 10 results:

curl -i -X GET \
  'https://api.whosonlocation.com/v1/location?q=staff_count>200&limit=10'
   -H 'Content-Type: application/json' \
   -H 'Authorization: APIKEY abcdef1234567890' \

Check the reponse

Successful responses will have an HTTP 200/204 status code. Non-2xx HTTP status codes are errors.