Work with your REST Client

REST APIs use HTTP methods to send and receive content. Therefore, you can test REST APIs using any programming language or tool that supports sending and receiving HTTP messages. So let's first choose a tool for making HTTP requests.

Note:

Oracle REST APIs aren't OData (Open Data Protocol) compliant.

Considerations for Choosing a REST Client

You can select an internet-accessible application or a programming platform that interacts with Oracle Fusion Cloud HCM, such as:

Note:

Tools such as cURL, Postman, Advanced REST Client, and other clients are third-party tools. Therefore, Oracle does not provide support for these tools. You can select the tool based on your requirements.

With a REST client you can:

  • Test the username, password, and request URL for your REST API account.
  • Perform view and describe actions to learn more about REST resources, attributes, and parameters.
  • Use the information to construct and send various types of HTTP requests to create, update, or delete records.

How You Use cURL to Send HTTP Requests

In our examples, we use cURL, a popular command-line utility for transferring data using URL syntax, to send requests to REST services. cURL is available in most UNIX, Windows, and Macintosh environments. For details, see Installing the cURL Command-Line Tool on Windows.

This table describes commonly used cURL options that you can use for REST services.

Option Description

-user

username:password

Specifies the user name and password for server authentication.

-d

Sends the specified data (a JSON request body) to the server. If you begin the data with the @ sign, then @ must be followed by a file name to read the data from.

-H

Specifies an extra HTTP header in the request. To specify multiple headers, precede each header with the -H option.

Examples:
  • Content-Type: Format of request body (for example, with POST)
  • Accept: Format of response body
  • X-Auth-Token: Authentication token

-output

<file>

Writes the output to a file instead of to stdout.

-X

Specifies the request method to use when communicating with the HTTP server. The default method is GET.

This table shows examples of GET, POST, and PATCH operations on the workers resource using cURL.

Operation cURL Command Example

GET

Retrieve a worker

curl -u username:password -H "Content-Type: application/vnd.oracle.adf.resourceitem+json" -H "REST-Framework-Version: 4" -X GET "https://us.example.com/hcmRestApi/resources/11.13.18.05/workers?q=names.LastName='Doe'"

POST

Create a worker

curl -u username:password -H "Content-Type: application/vnd.oracle.adf.resourceitem+json" -H "REST-Framework-Version: 4" -H "Effective-Of:RangeStartDate=2018-01-01" -X POST -d <payload> "https://us.example.com/hcmRestApi/resources/11.13.18.05/workers"

PATCH

Update a worker

curl -u username:password -H "Content-Type: application/vnd.oracle.adf.resourceitem+json" -X PATCH -d <payload> "https://us.example.com/hcmRestApi/resources/11.13.18.05/workers/{Id}"

How You Use Clients to Send HTTP Requests

You can use standalone clients, third-party browser extensions, or add-ons, such as the Advanced REST Client, to send HTTP requests. This table shows examples of GET, POST, and PATCH operations on the workers resource using a client.

Operation Request URL Request/Response

GET

Get a worker

https://us.example.com/hcmRestApi/resources/11.13.18.05/workers?q=names.LastName='Doe'

Response

{
  "PersonId": 300100215315227,
  "PersonNumber": "960000000000900",
  "CorrespondenceLanguage": null,
  "BloodType": null,
  "DateOfBirth": null,
  "DateOfDeath": null,
  "CountryOfBirth": null,
  "RegionOfBirth": null,
  "TownOfBirth": null,
  "ApplicantNumber": null,
  "CreatedBy": "VMOSS",
  "CreationDate": "2019-04-23T10:25:40+00:00",
  "LastUpdatedBy": "VMOSS",
  "LastUpdateDate": "2019-04-23T10:25:44.457+00:00",
  "workRelationships": {
      "items": [
          {
              "PeriodOfServiceId": 300100215315230,
              "LegislationCode": "US",
              "LegalEntityId": 100000011593283,
              "LegalEmployerName": null,
              "WorkerType": "E",
              "PrimaryFlag": true,
              "StartDate": "2018-01-01",
              "LegalEmployerSeniorityDate": null,
              "EnterpriseSeniorityDate": null,
              "OnMilitaryServiceFlag": false,
              "WorkerNumber": null,
              "ReadyToConvertFlag": null,
              "TerminationDate": null,
              "NotificationDate": null,
              "LastWorkingDate": null,
              "RevokeUserAccess": null,
              "RecommendedForRehire": "ORA_NS",
              "RecommendationReason": null,
              "RecommendationAuthorizedByPersonId": null,
              "CreatedBy": "VMOSS",
              "CreationDate": "2019-04-23T10:25:40.075+00:00",
              "LastUpdatedBy": "VMOSS",
              "LastUpdateDate": "2019-04-23T10:25:45.295+00:00",
              "assignments": {
                  "items": [
                      {
                          "AssignmentId": 300100215315237,
                          "AssignmentNumber": "E960000000000900",
                          "AssignmentName": "E960000000000900",
                          "ActionCode": "HIRE",
                          "ReasonCode": null,
                          "EffectiveStartDate": "2018-01-01",
                          "EffectiveEndDate": "4712-12-31",
                          "EffectiveSequence": 1,
                          "EffectiveLatestChange": "Y",
                          "BusinessUnitId": 100010025072009,
                          "BusinessUnitName": "GBI HCM-Financials USA BU",
                          "AssignmentType": "E",
                           ...
                          "links": [
                              {
                                 ...}
          }
    ]
} 

POST

Create a worker

Header: Effective-Of:RangeStartDate=2018-01-01

https://us.example.com/hcmRestApi/resources/11.13.18.05/workers

Request

{
  "names": [
    {
      "LastName": "Doe",
      "LegislationCode": "US"
    }
  ],
  "workRelationships": [
    {
      "LegalEmployerName": "GBI HCM Widgets USA",
      "WorkerType": "E",
      "assignments": [ 
        {
          "ActionCode": "HIRE",
          "BusinessUnitName": "GBI HCM-Financials USA BU"
        }
      ]
    }
  ]
}

PATCH

Update a worker

https://us.example.com/hcmRestApi/resources/11.13.18.05/workers/{Id}

Request

{
 "DateOfBirth": "1987-01-01",
 "CountryOfBirth" : "US"
 }

With an understanding of how your client works, you can next review Manage Workers for sample workflows that demonstrate how to create, update, and retrieve information about a worker.