How to Use the API with the Postman Application

Article author
Learning Center Mekari
  • Updated

If you use Talenta, you can integrate it with other applications. To be able to do this, you need an API that works to integrate third-party backend services with Talenta's central HRIS system. To check the results of the API data, you can use applications such as Postman and Insomnia. You can also click here to learn how to integrate Talenta with HMAC.

Important
The following guide is for testing using Postman, implementation in other programming languages ​​is the responsibility of the user. As an example and general introduction to HMAC authentication, you can see it here

Following are the steps for checking the API via Postman.

  1. Download and install Postman apps here.
  2. Generate API Token at https://developers.mekari.com
  3. Then input the Application Name.
    Untitled__6_.png
  4. And select Company.
    Untitled__7_.png
  5. Choose the scope you want. The following is an example if the scope is selected for the employee list to get data for all employees.
    Untitled__8_.png
  6. Then click “Submit”.
  7. Next, the API Token will appear as follows. Click the "copy" icon to copy the Client ID and Client Secret.
    Untitled__9_.png
  8. Then, open the Postman Application and paste the Client ID and Client Secret like the following example.
    Untitled__10_.png
    No Explanation
    1 In number 1, make sure the method entered is in accordance with the documentation. In this case the method used is GET.
    2 In number 2, make sure the URL entered is the URL link you want to go to. In this case https://api.mekari.com/v2/talenta/v2/employee?limit=20
    3

    At number 3 enter the following code.

    const Header = require('postman-collection').Header;
    const url = require('url');
    const hmac_username = "HMAC_USERNAME";
    const hmac_secret = "HMAC_SECRET";
    const requestUrl = url.parse(request['url']);
    const requestLine = pm.request.method + ' ' + requestUrl.path + ' HTTP/1.1';
    const dateString = new Date().toUTCString();
    const digest = CryptoJS.HmacSHA256(['date: ' + dateString, requestLine].join('\n'), hmac_secret);
    const signature = CryptoJS.enc.Base64.stringify(digest);
    const hmac_header = 'hmac username="' + hmac_username + '", algorithm="hmac-sha256", headers="date request-line", signature="' + signature + '"'
    pm.request.headers.add(new Header("Authorization: " + hmac_header));
    pm.request.headers.add(new Header("Date: " + dateString));

    4 Enter the token according to the token that was generated at point 7.
  9. If successful, the following will appear in the response section.

This is an explanation of how to use the API with the Postman application. Furthermore, you can learn how to mask data in the Talenta API here.