Manage Object Snapshots

You may need to integrate Oracle HCM Cloud with an internal expense application. When a new hire is created in Oracle HCM Cloud, you want to create the new hire in your internal expense application and let the new hire start filing expense reports immediately after onboarding is complete. You can use the objectSnapshots resource to retrieve the new hire details from Oracle HCM Cloud. Let's discuss this scenario.

You need to first enable the extract to use with the objectSnapshots REST API. Follow these steps:

  1. Log in to Oracle HCM Cloud.
  2. On the Home page, search for and select Data Exchange under the My Client Groups tab.
  3. Query the extract that you want to enable for the resource. Let's say that PersonRecord is the name of the extract.
  4. Navigate to the data group that has the threading database item defined. You can only enable extracts for use with the API if the root data group has the threading DBI defined.
  5. Select the Enable Object Snapshot attribute and validate the extract.

    The threading DBI defined for the extracts automatically defaults as the snapshot key attribute. Let's say that the threading DBI is Extract Person ID.

    Note:

    Oracle HCM Cloud supports only numeric keys as snapshot keys. If the threading DBI defined in extracts is a non-numeric ID, the snapshot key wouldn't be the default and this extract can't be used with the objectSnapshots resource.

Note:

The objectSnapshots resource honors the data security granted to the user who is invoking the API. Unlike Extracts that runs using the APPID user (elevated user), this resource can only retrieve data for which the invoking user has access granted via associated data security privileges.

Get New Hire Details

Let's say that you have an HCM Extract PersonRecord to extract employee details with demographic data for employees in bulk. Your extract has a threading database item defined as Extract Person ID. In this scenario, you're running this extract and reading the output for new hires created in Oracle HCM Cloud.

The PersonRecord extract is enabled to be called using the objectSnapshots resource. You can subscribe to New Hire Atom feeds to identify the new hires created in Oracle HCM Cloud.

To retrieve the new hire details using the objectSnapshots resource:

  1. Use the New Hire feed to get the PersonId of the new hire created.
  2. Perform a POST operation on the objectSnapshots resource by providing the PersonId as the snapshot key in the request body.
  3. Verify the new hire details returned in the response.

Example URL

Use this resource URL format.

POST

/hcmRestApi/objectSnapshots

Example Request

Here's an example of the request body in JSON format.

{
    "ExtractsDefinitionName": "PersonRecord",
    "snapshotKey": "955160008176443",
    "parameters": [
        {
            "name": "effective_date",
            "value": "2020-10-31"
        }
    ]
}

Example Response

Here's an example of the response body in JSON format.

Note that the file content in the response payload is base64 encoded data. When the data is decoded, you would get the XML output of the original extract.

{
    "status": "OK",
    "message": "Success",
    "ExtractsDefinitionName": "PersonRecord",
    "snapshotKey": "955160008176443",
    "parameters": {
        "name": "effective_date",
        "value": "2020-10-31"
    },
    "FileContent": "PFBlcnNvblJlY29yZD48UkVQX0NBVEVHT1JZX05BTUU+UGVyc29uUmVjb3JkPC9SRVBfQ0FURUdPUllfTkFNRT48cGFyYW1ldGV
ycz48cmVxdWVzdF9pZC8+PEZMT1dfTkFNRS8+PGxlZ2lzbGF0aXZlX2RhdGFfZ3JvdXBfaWQvPjxlZmZlY3RpdmVfZGF0ZT4yMDIwLTEwLTMxPC9lZmZlY3
RpdmVfZGF0ZT48c3RhcnRfZGF0ZT4yMDIxLTA1LTI1PC9zdGFydF9kYXRlPjxyZXBvcnRfY2F0ZWdvcnlfaWQ+MzAwMTAwNTQ1Nzg5Nzk5PC9yZXBvcnRfY
2F0ZWdvcnlfaWQ+PGFjdGlvbl9wYXJhbWV0ZXJfZ3JvdXBfaWQvPjxjaGFuZ2VzX29ubHkvPjwvcGFyYW1ldGVycz48L1BlcnNvblJlY29yZD4K"
}