Modify

You can modify a resource by adding, updating, or deleting an item.

Add an Item

To add a resource item, execute a POST request on the collection resource URL. Set the Content-Type header to application/vnd.oracle.adf.resourceitem+json. This is required for POST and PATCH requests.

In this example, an email is added to the worker emails collection.

Request

POST/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED00057708000000005/child/emails
Content-Type: application/vnd.oracle.adf.resourceitem+json
{
  "EmailType": "H1",
  "EmailAddress": "example07@example.com"
}

Response

The response returns the representation of the newly created photo resource.

201 CREATED
  
{
  "EmailAddressId": 300100189183231,
  "EmailType": "H1",
  "EmailAddress": "example07@example.com",
  "FromDate": "2019-07-25",
  "ToDate": null,
  "CreatedBy": "HCM_INTEGRATION_SPEC",
  "CreationDate": "2019-07-25T19:45:51+00:00",
  "LastUpdatedBy": "HCM_INTEGRATION_SPEC",
  "LastUpdateDate": "2019-07-25T19:45:51.029+00:00",
  "PrimaryFlag": false,
  "links": [
    {
      ...}
  ]
}

To exclude the resource representation in the response, specify the Content-Type header and use the Accept request header with qualifier 0. Here's an example.

Request

POST /hcmRestApi/resources/11.13.18.05/workers/00020000000EACED00057708000000005/child/emails
Accept: application/json;q=0
Content-Type: application/vnd.oracle.adf.resourceitem+json
{
  "EmailType": "H1",
  "EmailAddress": "example07@example.com"
}

Response

The response does not return content.

204 No Content

Update an Item

To update a resource item, execute a PATCH request on the resource URL. Set the Content-Type header to application/vnd.oracle.adf.resourceitem+json and include the payload with the required changes.

In this example, the email address of a worker has been updated.

Request

PATCH /hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/emails/300100189576353 Content-Type: application/vnd.oracle.adf.resourceitem+json
{
  "EmailAddress": "example07@example.com"
}

Response

The response includes the current representation of the resource in the response body and the ETag value in the response header.

200 OK
Etag: "ACED0005737200136A6176612E7574696C2E"
{
  "EmailAddressId": 300100189576353,
  "EmailType": "H1",
  "EmailAddress": "example07@example.com",
  ....
  "links": [
    {
      "rel": "self",
      "href": "https://<host>:<port>/>hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/emails/300100189576353",
      "name": "emails",
      "kind": "item",
      "properties": {
        "changeIndicator": "ACED0005737200136A6176612E7574696C2E"
      }
    },
   ]
}

To exclude the resource representation in the response, specify the Content Type header and use the Accept request header with qualifier 0. Here's an example.

Request

PATCH /hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/emails/300100189576353
Accept: application/json;q=0
Content-Type: application/vnd.oracle.adf.resourceitem+json
{
  "EmailAddress": "example07@example.com"
}

Response

The response contains only the ETag value.

204 No Content
Etag: "ACED0005737200136A6176612E7574696C2E"

Delete an Item

To delete a resource item, execute a DELETE request on the individual resource URL. For example, to delete an email:

Delete the email using the self link.

DELETE /hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/emails/300100189576343

Response

The response does not return content.

204 No Content