Rest API

Currently, Icehrm exposes employee details and attendance data via the REST API.

Full API Documentation can be found here: https://icehrm.docs.apiary.io/#

Setting up IceHrm Open Source and Pro REST Api – Nginx #

IceHrm includes a REST API but it needs to be configured via web server configurations.

Basically, all the requests coming to icehrm.url/app/api/ should be redirected to icehrm.url/app/index.php

For example, if you are using Nginx web server you need to add the following location block inside your sever block in the Nginx config file for your site.

location /app/api/ {
    try_files $uri /app/api/index.php?/$uri&$args;
}

If IceHrm is not loaded from web root, for example, if your Icehrm url is your-icehrm-url.com/icehrm instead of your-icehrm-url.com you should add any directory in relative path to location block as in the following example

location /icehrm/app/api/ {
    try_files $uri /icehrm/app/api/index.php?/$uri&$args;
}

Setting up IceHrm Open Source and Pro REST Api – Apache (XAMPP, WAMPP) #

For Apache web server, we have already included a .htaccess file under icehrm/app/api. This will redirect the API request properly.

Testing Rest Api #

  • First you should enable REST api via Settings -> Other -> Enable REST Api setting
  • Visit your-icehrm-url.com/app/api/echo
  • This should output an echo with a random number

Using REST Api with Open Source and IceHrmPro #

Your API URL base will be http://your-icehrm-url.com/app/api. If you want to call employees/me, you should send a request to http://your-icehrm-url.com/app/api/employees/me.

Powered by BetterDocs