I would like to start a short series about using REST API in Oracle HCM Cloud. As far as you know, you can use Oracle REST APIs to view and manage data stored in Oracle Applications Cloud and those can be used as a bridge between external applications and Oracle HCM Cloud.
There is a big list of APIs available: https://docs.oracle.com/en/cloud/saas/human-resources/20a/farws/index.html
If you are new to REST I would recommend going through my article that describes a concept: https://hcmcloudhub.com/2016/01/16/an-introduction-to-the-rest-apis-in-oracle-hcm-cloud/
In this post I am going to outline several parameters that may be useful while working with Employees/Assignment REST Endpoints:
Limit attributes to be retrieved
To decrease the size of the resulting payload, specify which attributes should be returned by using the fields parameter:
Exclude all links
The onlyData parameter can be used to exclude all links in the response payload so that it reduces the size of the retrieved message.
Using the self link to get access to a specific resource
You first need to obtain the self link to the resource:
GET https://podname.fa.em2.oraclecloud.com/hcmRestApi/resources/latest/emps?fields=PersonNumber&q=PersonNumber=100012Then use it to access to a specific resource or a child resource:
GET https://podname.fa.em2.oraclecloud.com:443/hcmRestApi/resources/11.13.18.05/emps/00020000000EACED00057708000110D931904BD 30000004AACED00057372000D6A6176612E73716C2E4461746514FA46683F3566970200007872000E6A6176612E7574696C2E44617465686A 81014B59741903000078707708000001708917C00078?fields=DisplayName,FirstName,LastName;assignments:JobId,DepartmentId;roles:RoleName&onlyData=true
Get specific attributes of a child resource
Use the fields parameter, to include attributes of one or more child resources
GET https://podname.fa.em2.oraclecloud.com:443/hcmRestApi/resources/11.13.18.05/emps/00020000000EACED00057708000110D931904BD 30000004AACED00057372000D6A6176612E73716C2E4461746514FA46683F3566970200007872000E6A6176612E7574696C2E44617465686A 81014B59741903000078707708000001708917C00078?fields=DisplayName,FirstName,LastName;assignments:JobId,DepartmentId;assignments.JobIdLOV:JobCode;assignments.JobIdLOV:JobCode,Name
As you can see it fetches all values in JobIdLov, so you have to handle this accordingly.
Below is my sample code that is written on a Python language and it’s intended only for demonstration purposes. I like Python as it is very convenient to work with JSON, but it’s up to you.
As you can see credentials and a POD URL stored in the demo_user.json file apart from this code.
Below is a part of the output generated by this code:
I hope it helps.
Pingback: Oracle HCM Cloud REST API how-to miniseries || – Setting a REST API Framework Version | HCM Cloud Hub