People API methods

As mentioned before each API call must be authorized by a valid authorization token. To get the valid authorization token you must authenticate user first.

Get list of people

# Get all people
$ http GET https://secure.yardman.io/api/people \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg"

If the authorization token is valid you should get something similar to the following result:

HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 21 Mar 2018 18:51:35 GMT
ETag: W/"846c15267405fea6dd9b4185214f9293"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: a5ec861a-5266-4707-b477-19c28ca1aeb3
X-Runtime: 0.016674
X-XSS-Protection: 1; mode=block

[
    {
        "driving_license_number": null,
        "email": null,
        "first_name": "Jakob",
        "id": 95,
        "last_name": "Adams",
        "mobile_phone": null,
        "notes": null,
        "status": "unknown"
    },
    {
        "driving_license_number": null,
        "email": null,
        "first_name": "Therese",
        "id": 77,
        "last_name": "Altenwerth",
        "mobile_phone": null,
        "notes": null,
        "status": "unknown"
    },
    {
        "driving_license_number": null,
        "email": null,
        "first_name": "Theresa",
        "id": 140,
        "last_name": "Ankunding",
        "mobile_phone": null,
        "notes": null,
        "status": "unknown"
    },
    {
        "driving_license_number": null,
        "email": null,
        "first_name": "Lue",
        "id": 149,
        "last_name": "Bahringer",
        "mobile_phone": null,
        "notes": null,
        "status": "unknown"
    },
    {
        "driving_license_number": null,
        "email": null,
        "first_name": "Peggie",
        "id": 73,
        "last_name": "Bailey",
        "mobile_phone": null,
        "notes": null,
        "status": "unknown"
    },
    {
        "driving_license_number": null,
        "email": null,
        "first_name": "Camden",
        "id": 59,
        "last_name": "Beier",
        "mobile_phone": null,
        "notes": null,
        "status": "unknown"
    },
    # ... cropped for clarity ...
]

Result filtering

Simple result filtering is implemented as query parameter q on top of the base URL. You may filter (search) by:

  • first name
  • last name
  • full name
  • driving license number
  • mobile phone number
  • status

Please note, you may mix’n’match filtering parameter along with pagination parameters to get desired results.

# Find people with DJAS244 driving license number (mind the q param)
$ http GET https://secure.yardman.io/api/people \
> q==DJAS244 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNDA2MDE1fQ.NO5mBUn6R5qVYPBrbrHwQRTjrDyZL_rSFUk8qYOpeBc"

If the authorization token is valid you should get something similar to the following result:

HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Nov 2018 15:45:12 GMT
ETag: W/"a8b1a2706765a78a6a5774653b1d9217"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 1ee36544-f50a-46c3-8382-13a9bdc9d1e9
X-Runtime: 0.014886
X-XSS-Protection: 1; mode=block

[
    {
        "driving_license_number": "DJAS244",
        "email": null,
        "first_name": "Edmund",
        "id": 138,
        "last_name": "Reichert",
        "mobile_phone": "+48600100100",
        "notes": null,
        "status": "unknown"
    }
]

Create new person

# Create new person
$ http POST https://secure.yardman.io/api/people \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> first_name=Liam \
> last_name=Ankunding \
> driving_license_number=JJ6512A \
> mobile_phone="+4790060550" \
> email="liam.ankunding@example.com" \
> notes="Internal Driver No: 1135"

If the authorization token is valid you should get something similar to the following result:

HTTP/1.1 201 Created
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 21 Mar 2018 18:54:03 GMT
ETag: W/"8d0167b13bd12721c1f19f8d1b9d95dd"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 3d7c6e56-1ab5-4b72-979e-63b1adc5157b
X-Runtime: 0.049692
X-XSS-Protection: 1; mode=block

{
    "driving_license_number": "JJ6512A",
    "email": "liam.ankunding@example.com",
    "first_name": "Liam",
    "id": 152,
    "last_name": "Ankunding",
    "mobile_phone": "+4790060550",
    "notes": "Internal Driver No: 1135",
    "status": "unknown"
}

Show person data

To show the person data you have to provide its id value.

# Show person no. 152
$ http GET https://secure.yardman.io/api/people/152 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNDA2MDE1fQ.NO5mBUn6R5qVYPBrbrHwQRTjrDyZL_rSFUk8qYOpeBc"

If the authorization token is valid you should get something similar to the following result:

HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Nov 2018 12:14:51 GMT
ETag: W/"6dc35cd9261a279871260224b20592bf"
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: d930e481-4805-43b7-8750-464c6371cc48
X-Runtime: 0.007992
X-XSS-Protection: 1; mode=block

{
    "driving_license_number": "JJ6512A",
    "email": "liam.ankunding@example.com",
    "first_name": "Adam",
    "id": 152,
    "last_name": "Ankunding",
    "mobile_phone": "+48790060566",
    "notes": "Internal Driver No: 1135",
    "status": "waiting"
}

Update person data

To update the person data you have to provide its id value and data to be updated.

# Update recently added person
$ http PUT https://secure.yardman.io/api/people/152 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> first_name=Adam

If the authorization token is valid you should get something similar to the following result:

HTTP/1.1 204 No Content
Cache-Control: no-cache
Connection: keep-alive
Date: Wed, 21 Mar 2018 18:55:19 GMT
Server: nginx/1.10.3 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: d0ae012a-dc87-43f0-ba7f-f90b97a67c6d
X-Runtime: 0.050024
X-XSS-Protection: 1; mode=block