top of page

Getting started with APIs

I'll be introducing a considerable amount of technical terminology, so before diving in, familiarize yourself with these key API terms.

API call
The process of a client (your computer) initiating an API request to a server
Request method
Utilizes HTTP methods (GET, POST, PUT, DELETE) to instruct the API on the desired action
Endpoint
The digital location where an API receives requests for its resources
API key
A unique combination of letters and numbers providing access to an API

Step 1: Obtain API key from AanyaHR v2 Portal

Login to appv2.aanyahr.com and navigate to your company's profile. Within your company's profile, you will find your API key.

image.png

In case that that you have no API key, click Generate.

Step 2: Obtain Authorization token using Request Access Token API

The next step is to obtain an authorization token using the token endpoint. This token is essential for authenticating and authorizing your requests to the API

Using your preferred testing tool (e.g., Postman), set the endpoint to https://appv2.aanyahr.com:3000/api/connect/token and the request method to POST

image.png

Then enter the following body parameters:

image.png

Where client_id is your company code and client_secret is the API key from Step 1

Then click Send. You will receive a response similar to the snippet below on a successful API call.

image.png

where access_token is the authorization token use to call other APIs and expires_in is the validity duration of the generated access_token in seconds

Take note of this token, as you'll need it for subsequent API calls.

Step 3: Obtain Client Key using Request Client Key API

Now that you have the authorization token, the next step you need to do is get the client key from clientKey endpoint

Using the same testing tool used for Step 2, set the endpoint to https://appv2.aanyahr.com:3000/api/connect/clientKey and the request method to POST

image.png

On authorization, set type to Bearer Token and enter the token generated from step 2

image.png

Then enter the following body parameters:

image.png

Where client_id is your company code and client_secret is the API key from Step 1

Then click Send. You will receive a response similar to the snippet below on a successful API call.

image.png

Save this response, as it is required for the authentication of subsequent API calls.

Step 4: Make API Calls with Authorization Token and Authentication Keys

Now that you have the necessary authorizations (API authorization token and authentication keys), you can use them in the headers of your requests to the desired API endpoints. Let's consider an example using the GetEmployee01 endpoint.

Using the same testing tool used for Step 2, set the endpoint to https://appv2.aanyahr.com:3000/api/connect/getEmployee01 and the request method to POST

image.png

Enter Header params

image.png

Where values for User, LoginID, and Series are from response of successful clientKey API call, and Authorization value is from response of successful token API call.

Then enter the following body parameters and click send:

image.png

You will receive a response similar to the snippet below on a successful API call.

image.png

Congratulations! You have successfully obtained the necessary authorization tokens and made authenticated API calls. Now, you're ready to seamlessly incorporate our APIs into your applications

bottom of page