API Docs

We are happy to provide you with REST API that will allow you to integrate your applications with our system. The REST API provides access to creating, modifying and removing Jobs, Surveys and their respective webhooks. OAuth 2.0 is used as the API Authorization framework, Request and responses are formatted as JSON and cURL is used access the REST API endpoints.


Getting access token

Step one: Create an Oauth2 application

  • Ensure you already have an account.
  • And you have been assigned the various roles related to the specific endpoints, e.g job_read, job_write roles.
  • While creating the oauth2 application, its recommended to have client type as Confidential.

Step two: Request Authorization token

curl -X POST -d "grant_type=<grant_type>&username=<user_name>&password=<password>" http://<client_id>:<client_secret>@https://www.authenticatestaff.com/api/oauth/token/

Test Credentials

Username: Adm1n
Password: Passw0rd

Request a token curl -X POST -d "grant_type=password&username=Adm1n&password=Passw0rd" http://123asd456:654dfg321@https://www.authenticatestaff.com/api/oauth/token/

Example response from request above {"access_token": "2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ", "token_type": "Bearer", "expires_in": 604800, "refresh_token": "IqDophHyOnVrIKrVr7lB5H5ZShGLVa", "scope": "read write"}


How-Tos and Examples

Using the access token obtained above, you can easily access the API endpoints.

Examples below

Creating a new job curl -X POST https://www.authenticatestaff.com/api/jobs/create/ -d "company_job_id=12345678&customer_first_name=john& customer_last_name=doe&customer_phone=321321&email=john@doe.com&job_date=2015-03-23&start_time=12:12:00& end_time=11:30:00" -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Lists all jobs curl -H "Authorization: Bearer mcc74MgC3S7sOwb6vqUzJcScIerYyL" https://www.authenticatestaff.com/api/jobs/
Updating an existing job curl -X PUT https://www.authenticatestaff.com/api/jobs/update/1/ -d "company_job_id=9999&customer_first_name=john& customer_last_name=doe&customer_phone=321321&email=john@doe.com&job_date=2015-03-23&start_time=12:12:00& end_time=11:30:00" -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Deleting a job curl -X DELETE https://www.authenticatestaff.com/api/jobs/delete/1/ -H 'Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ'
Creating a new survey curl -X POST https://www.authenticatestaff.com/api/surveys/create/ -d "name=reviewing customer satisfaction& description=how well did the service got delivered&mode=1" -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Lists all surveys curl -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ" https://www.authenticatestaff.com/api/surveys/
Updating survey curl -X PUT https://www.authenticatestaff.com/api/surveys/update/1/ -d "name=reviweing customer satisfaction& description=how well did the service got delivered&mode=1" -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Deleting a survey curl -X DELETE https://www.authenticatestaff.com/api/surveys/delete/1/ -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Creating a new webhook curl -X POST https://www.authenticatestaff.com/api/webhooks/create/ -d "target=https://example.com&event=survey.removed" -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Lists all webhooks curl -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ" https://www.authenticatestaff.com/api/webhooks/
Updating a webhook curl -X PUT https://www.authenticatestaff.com/api/webhooks/update/1/ -d "target=http://example.com&event=job.removed" -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"
Deleting a webhook curl -X DELETE https://www.authenticatestaff.com/api/webhooks/delete/1/ -H "Authorization: Bearer 2lLICeZw2fGaI5tT3UJ780tjgtu0ZQ"


Request and Response Formats

Requests and responses are formatted in three modes: JSON, XML, YAML. By default JSON is rendered. To return a response with a different format, you need to pass it in the request accept header.

Examples

JSON
curl -H "Authorization: Bearer <token>" https://www.authenticatestaff.com/api/jobs/ -H "Accept: application/json" -H "Accept: application/json; indent=4"
YAML
curl -H "Authorization: Bearer <token>" https://www.authenticatestaff.com/api/jobs/ -H "Accept: application/yaml"
XML
curl -H "Authorization: Bearer <token>" https://www.authenticatestaff.com/api/jobs/ -H "Accept: application/xml"

Jobs webhooks

The following events webhooks are available for Jobs

  • job.added
  • job.modified
  • job.removed

Survey webhooks

The following events webhooks are available for Surveys

  • survey.added
  • survey.modified
  • survey.removed
  • response.created

Accessing Jobs API Endpoints

List all jobs

curl -H "Authorization: Bearer <token>" https://www.authenticatestaff.com/api/jobs/

Creating a new job

curl -X POST https://www.authenticatestaff.com/api/jobs/create/ -d "company_job_id=<company_job_id>& customer_first_name=<customer_first_name>&customer_last_name=<customer_last_name>& customer_phone=<customer_phone>&email=<email>&job_date=<job_date>&start_time=< start_time>&end_time=<end_time>" -H "Authorization: Bearer <token>"

Update existing job

curl -X POST https://www.authenticatestaff.com/api/jobs/create/ -d "company_job_id=<company_job_id>& customer_first_name=<customer_first_name>&customer_last_name=<customer_last_name>& customer_phone=<customer_phone>&email=<email>&job_date=<job_date>&start_time=< start_time>&end_time=<end_time>" -H "Authorization: Bearer <token>"

Delete job

curl -X DELETE https://www.authenticatestaff.com/api/jobs/delete/<job_pk>/ -H "Authorization: Bearer <token>"

Accessing Jobs API Endpoints

List all jobs

curl -H "Authorization: Bearer <token>" https://www.authenticatestaff.com/api/jobs/

Creating a new job

curl -X POST https://www.authenticatestaff.com/api/jobs/create/ -d "company_job_id=<company_job_id>& customer_first_name=<customer_first_name>&customer_last_name=<customer_last_name>& customer_phone=<customer_phone>&email=<email>&job_date=<job_date>&start_time=< start_time>&end_time=<end_time>" -H "Authorization: Bearer <token>"

Update existing job

curl -X POST https://www.authenticatestaff.com/api/jobs/create/ -d "company_job_id=<company_job_id>& customer_first_name=<customer_first_name>&customer_last_name=<customer_last_name>& customer_phone=<customer_phone>&email=<email>&job_date=<job_date>&start_time=< start_time>&end_time=<end_time>" -H "Authorization: Bearer <token>"

Delete job

curl -X DELETE https://www.authenticatestaff.com/api/jobs/delete/<job_pk>/ -H "Authorization: Bearer <token>"