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 companies
# Get all companies
$ http GET https://secure.yardman.io/api/companies \
> 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:42:48 GMT
ETag: W/"dfb25579c43ba6edef67e55394ddb939"
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: 8e0f6ad5-2837-46c8-9a1f-794eaf3cb17b
X-Runtime: 0.012807
X-XSS-Protection: 1; mode=block
[
{
"email": null,
"id": 69,
"name": "Bahringer Inc",
"notes": null
},
{
"email": null,
"id": 39,
"name": "Barton-Labadie",
"notes": null
},
{
"email": null,
"id": 34,
"name": "Becker, Berge and Durgan",
"notes": null
},
{
"email": null,
"id": 38,
"name": "Bernier, Romaguera and Kohler",
"notes": null
},
{
"email": null,
"id": 55,
"name": "Bruen-Luettgen",
"notes": null
},
{
"email": null,
"id": 71,
"name": "Cole Group",
"notes": null
},
{
"email": null,
"id": 29,
"name": "Corkery, Hilpert and Frami",
"notes": null
},
# ... 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 name or email.
Please note, you may mix’n’match filtering parameter along with pagination parameters to get desired results.
# Find companies with mail@bahringer.com email (mind the q param)
$ http GET https://secure.yardman.io/api/companies \
> q==mail@bahringer.com \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyOCwiZXhwIjoxNTQzNDA2MDE1fQ.NO5mBUn6R5qVYPBrbrHwQRTjrDyZL_rSFUk8qYOpeBc"
or
# Find companies with Bahringer as a part of company name (mind the q param)
$ http GET https://secure.yardman.io/api/companies \
> q==Bahringer \
> 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:07:15 GMT
ETag: W/"d486b14de20895c662eb9f9d10543e59"
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: a199a789-a367-49e8-bebc-fdd2a072228f
X-Runtime: 0.016309
X-XSS-Protection: 1; mode=block
[
{
"email": "mail@bahringer.com",
"id": 69,
"name": "Bahringer Inc",
"notes": null
}
]
Create new company
# Create new company
$ http POST https://secure.yardman.io/api/companies \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> name="Will-Sta Group"
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:46:41 GMT
ETag: W/"97b3b6970b37e91974cf185017d7bf99"
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: 00ff356f-8c54-4c9f-8ca4-480f2552587d
X-Runtime: 0.027756
X-XSS-Protection: 1; mode=block
{
"email": null,
"id": 75,
"name": "Will-Sta Group",
"notes": null
}
Update company data
To update the company data you have to provide its id
value and data to be
updated.
# Update recently added company
$ http PUT https://secure.yardman.io/api/companies/75 \
> Authorization:"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozOSwiZXhwIjoxNTE5Mjk3MDIyfQ.R5UoAglylK2i5ov4qDH9bJUqt3qJh7uLVA11dLGlozg" \
> name="Will-Std Group"
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:48:20 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: 45c53c5b-b7e7-4dcb-b80d-0228b110a46f
X-Runtime: 0.039153
X-XSS-Protection: 1; mode=block