This post will take you through a step-by-step Dimensions Rest API example in Postman. In our Postman example, we’ll be sending two requestions:
- Access Token – This retrieves the access token which we need to run the next request.
- Retrieve Person by Extension – This retrieves data about an employee.
If you just want the example code, we’re happy to send it to you.
We’re not going to repeat what’s available in the documentation. If you’re new, you may wonder to get to the documentation. The answer is the developer portal.
You can find the Developer Portal under administration:
Or by searching:
If the developer portal does not appear, have your administrator confirm that your Function Access Profile has the appropriate access. The required access can be found under:
Manager Common Setup -> Developer Portal -> Administration Access and Developer Access.
Please note that the account you’ll be using will need appropriate access to do whatever you’d like to do. You can’t look up an employee (as we’ll do in this example) if you don’t have access to the employee from with the application.
Now let’s show you how to find the documentation for our requests:
Dimensions Developer Portal Documentation
Step 1 – Authentication:
Unlike UKG Pro/UltiPro APIs which we’ve described here, Dimensions APIs require a two-step process. The first request gets you an access token which is then used in the second request..
To find the documentation from the developer portal, click on Authentication.
Again, I do suggest you read the documentation. We’re focusing on our particular Postman example. (And aren’t you missing SQL and your on-premise database already!)
Step 2 – Retrieve Person by Extension
We’re going to use a simple API which retrieves data for a particular person. To find the documentation, click under People under the API column.
Now, expand “Persons” and scroll down until you see “Retrieve Person by Extension”
And you’ll find the documentation:
You’ll find a search function at the top. However, I’ve found that it returns so many results that it’s at best “sub-optimal”.
Now to postman.
For the first part
We’ll be looking at four parts of the postman request.
For this example, everything that will be custom to your site is stored in an environment variable.
The environment will be called UKG Dimensions – For GitHub:
Here are all the variables we’ll be using:
We’ll review each of these in depth. However, in brief:
The first three values were provided during implementation. If you don’t have them, you can open a case to get them:
The next two are for the user that you will use to run the API
The appkey will need to be setup within the application. We’ll walk this through further in the post.
The Person_number can be any valid employee number in your application TO WHICH the username has access.
The AccessToken is a variable to pass the value from the authentication request to the second request.
The URL tell us the API you wish to call and the type of API (POST, GET, etc).
Please make sure you pay attention to the request type. Some request which are just reading data use POST. (As I figured out in the middle of a support call. Oops.)
The request needs the vanity URL. The vanity URL should be provided by the implementation team. Otherwise, you’ll need to open a case. (It took very little time to receive the information)
You only need two values in the headers. The content type is standard.
You need to set up the AppKey in the Dimensions application.
To do so, go to Application Setup -> Common Setup-> My Apps
Then click Add:
- Name your key. The name doesn’t matter and won’t be used anywhere else. (It can be called Fred. Not that I suggest that you do so.)
- Check what products this key may use.
- Click Save.
You should receive a message that the key was successfully created.
As I said, you don’t actually use the name you entered anywhere. Highlight the key (by clicking on it) and click details at the top:
Your appkey will appear. You may copy using the icon to the top right of the key:
The body has six values, four of which are variables.
Client ID and Client Secret were provided at implementation. If you don’t have them, you’ll need to open a support ticket.
The Username and Password can be for any Dimensions user with the appropriate security.
The entire point of this request is to get the access token.
This very small piece of java script saves the accessToken into the environment variable so that it may be used in the next request.
Retrieve Person by Extension
So, now you have you’re AccessToken. You probably want to actually do something. We’re going to get information for a given employee. This is actually a simpler request. Let’s parse the postman step by step.
In this case, we’ll look at the request, the parameters and the Headers.
You’ll see that the request uses the same VanityURL we used for the access token. Thus the great value of variables.
Also, we have one parameter called person_number which we assign in our environment variables.
The headers have three values, two of which are variables.
We’ve discussed both the appkey and the AccessToken previously.
Running the example.
To run the example, you need to:
- Update the variables.
- Run the authentication/AccessToken request.
- Run the Retrieve Person by Extension Request.
(Note that we should be able to call the AccessToken Request directly from the Retrieve Person by Extension request. When I have that working, I’ll update the code).
After all this, you have JSON. Which you have to parse. Which is a topic for another day.
If you have questions or comments, please leave them below. Or contact us if you’re interested in training, development or consulting.
And once again, we’re happy to send you the code.
*They do have examples in Curl and Java. As a data guy who longs for the days when SQL was my tool, let’s just say that I’m not going to learn Java. Indeed, when we need scripting, we use Powershell. And everything needs to start with Postman.