How to use the Ok Alone Lone Worker Api

Keeping lone workers safe is in everyones best interest. By using the Ok Alone API within your application, it simplifies the task of checking up on loan workers.

The following technical documentation is for integrating the Ok Alone API within your application.

The Ok Alone API includes a full set of features for retrieving status, checking in, starting/ending shifts and man-down alerts to send help if needed. All these features can be called by using the appropriate API endpoint such as: /start /end /help for the desired command using standard REST API protocol.

Getting Started with the API

To start using the lone worker API you need an Ok Alone account with api access. To do this please use the form at the bottom of the page to request access.

Adding Workers

You can use the lone worker dashbaord to add workers. This is also available as a javascript widget which you can add to your own system

Authentication

Once a worker is successfully added they will be assigned a unqiue token. This must be used in all future requests. For example:

?token=rigfn30wefne0r3hnfr4f4ffew3rwfw4f

Start a Shift for a Lone Worker

The first action for any worker is to start their shift. To do this you need to make the following request:
Endpoint: /status/start
Request: POST
Example curl request:

curl --request POST \
  --url 'https://okaloneapi.org/api/status/start?token=O8KFR2ENV01A0LW01BPZYMP2ELSWETOKOVCDY6BY3A1V5U3J8Y' \
  --header 'content-type: application/json' \

Check In for a Lone Worker

A worker can check in to let Ok Alone know that they are ok:
Endpoint: /status/ok
Request: POST
Example curl request:

curl --request POST \
  --url 'https://okaloneapi.org/api/status/ok?token=O8KFR2ENV01A0LW01BPZYMP2ELSWETOKOVCDY6BY3A1V5U3J8Y' \
  --header 'content-type: application/json' \

Get Help for a Lone Worker

A worker can request help from the Ok Alone system:
Endpoint: /status/help
Request: POST
Example curl request:

curl --request POST \
  --url 'https://okaloneapi.org/api/status/help?token=O8KFR2ENV01A0LW01BPZYMP2ELSWETOKOVCDY6BY3A1V5U3J8Y' \
  --header 'content-type: application/json' \

End a Shift for a Lone Worker

A worker can end a shift in the Ok Alone system:
Endpoint: /status/end
Request: POST
Example curl request:

curl --request POST \
  --url 'https://okaloneapi.org/api/status/end?token=O8KFR2ENV01A0LW01BPZYMP2ELSWETOKOVCDY6BY3A1V5U3J8Y' \
  --header 'content-type: application/json' \

Get your Current Shift Information

A worker can request their current shift information:
Endpoint: /status/info
Request: POST
Example curl request:

curl --request POST \
  --url 'https://okaloneapi.org/api/status/info?token=O8KFR2ENV01A0LW01BPZYMP2ELSWETOKOVCDY6BY3A1V5U3J8Y' \
  --header 'content-type: application/json' \

Send Worker Location

A worker can send their location with any of the above commands using a location json. Or with the custom endpoint:
Endpoint: /location/add
Request: POST
Location JSON:

{
"location": {
"lat": 54.3266022,
"lng": -2.776066,
"source": "gps",
"accuracy": 10
}
}

Example curl request:

curl --request POST \
   --url 'https://okalone.org/api/location/add?token=O8KFR2ENV01A0LW01BPZYMP2ELSWETOKOVCDY6BY3A1V5U3J8Y' \
   --header 'content-type: application/json' \
   --data '{
     "location": {
         "lat": 54.3266022,
         "lng": -2.776066,
         "source": "gps",
         "accuracy": 10
     }
 }'

Want to use our Api?

To find out more about how you can integrate our api please fill in the form below and one of our team will be in touch.