Specifying the parameters (HTTP or JSON)


Here they are sent in the HTTP form parameter style. The square bracket notation seen on lines 3-7 implies a nested object structure; this technique may be familiar to you from other web frameworks and APIs.The same request could be made by POSTing a whole JSON object, similar to the response:

$ curl https://api.breathehr.com/v1/employees \
-H 'Content-Type:application/json' \
-H 'X-API-KEY: prod-1OcTwKW8ln5ARz04IjsrJEQTZgP3Ir1sWfyuOLdqC1Y' \
-d
{
  "employee": {
    "first_name": "foo",
    "last_name": "bar",
    "email": "foo@bar.com",
    "job_title": "Director",
    "join_date": "2014/10/01"
  }
}

Note that in listing 2, the Content-Type header is supplied with a value of application/json. This header is required for this alternative request format to function.