On Workhub, the customer API feature can be found under the Account module. This feature is meant to allow you to view data from Workhub on any other softwares you might currently use, and customize user compliance based on your needs. It allows you to use an API action to get worker data so it can be easily accessed without you having to login to your Workhub account and view compliance from the Admin side. You can use a third party app like Postman to access this data, or import into your own software.
To get started with setting up the API, the first thing you'll want to do is add an API call. From your Admin side, click Account then select the API tab
You will see a popup with all our current API templates. These are created from our database. Currently, there is only one template but there will be more coming!
Once you've added the template, you will see it appear in the List.
On the API details page, you will see various settings. You can add a description or notes of your API call to reference in the future if necessary. You will also see that some fields have been populated like the Request Type and Request Template.These cannot be changed, although you can select your preferences for the Output Format (JSON & XML) and Parameters (WorkerIDNumber & FirstName&MiddleName&LastName).
As you make changes to the parameters, you will see that the Website Address will automatically update to reflect these changes. These parameters are what you will use in your program to access the data. These parameters must be set in order to use the API call.
Also in this section, you will also see the Client Key and Client Secret listed under the Authorization heading. This will be a different Authorization code for each API call which is created. You can use this code to determine who is using the API feature to gather data. You can create multiple requests with different Authorization codes, and this could be set up for different departments in your company like Sales, HR, etc. There is also a button here to Regenerate the Authorization code, if compromised.
Now that we've covered the basics, we can use an app like Postman to test and access our API request.
Using Postman to test your API call
Now that you have your call created, you may want to test it in Postman. When you are adding it into another system, it is a little tricky because each program looks different when trying to create the request.
Keep in mind that the workerIDNumber is the ID# set in the worker’s Workhub profile and the GET request URL is the “Website address” . Parameters should populate from the url.
In postman I set a new key in the headers called “Authorization” with the value of “amx ClientKey: ClientSecret” so would be “amx 3A33DB77xxxxD8:K3F14PF2xxx8HYC” using the blanked out values above.
Please note, the client key and secret do not go in the authorization section, this section should be left blank.