POST

Use the POST HTTP method on a collection resource to create a new singular resource.

  • Execute the POST request on the collection resource URL.
  • Set the Content-Type header to application/vnd.oracle.adf.resourceitem+json.

In this example, a base64-encoded photo is added to the worker photos collection.

Request

The request payload contains a singular resource (a new photo).

POST https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED000577080000000000000018/child/photo
Content-Type: application/vnd.oracle.adf.resourceitem+json
{
  "PhotoType": "PROFILE",
  "Photo": "/9j/4AAQSkZJRgABAoEJRTJP/2Q=="
}

Response

The server creates a new photo and responds with status code 201 and the Location response header. The Location header contains the newly created resource URI if the resource can be independently referenced. The response body contains the newly created photo.

HTTP/1.1 201 Created
Location: https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/44617465686A81014B597419030/child/photo/30010074409
{
  "PhotoId": 300100187062448,
  "PrimaryFlag": true,
  "PhotoType": "PROFILE",
  "PhotoName": "100000015254281-2",
  "CreatedBy": "VMOSS",
  "CreationDate": "2019-05-16T10:20:25+00:00",
  "LastUpdatedBy": "VMOSS",
  "LastUpdateDate": "2019-05-16T10:20:25.453+00:00",
  "links": [
    {
      "rel": "self",
      ...
    },
    {
      "rel": "canonical",
      ...
    },
    {
      "rel": "parent",
     ...
    },
    {
      "rel": "enclosure",
      "href": "...",
      "name": "Image",
      "kind": "other"
    }
  ]
}