Singular Resources

A singular resource represents a single entity, such as a worker or a job. It has these features:

  • Contains a list of attributes (properties).
  • Can include a hierarchical structure that includes child resources.
  • Includes a links property that is used to access related resources.

In this example:

  • PersonId, PersonNumber, and DateOfBirth are properties of the workers resource.
  • links is an array of objects that contains references to related resources of the workers resource.
{
  "PersonId": 16590,
  "PersonNumber": "16590",
  "DateOfBirth": "1965-09-02",
  "links" : [
     {
          "rel" : "self",
          "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005",
          "name": "workers",
          "kind": "item",
          "properties": {
            "changeIndicator": "ACED0005737200136"
          }
        },
        {
          "rel": "canonical",
          "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005",
          "name": "workers",
          "kind": "item"
        },
        {
          "rel": "child",
          "href": ""https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/addresses",
          "name": "addresses",
          "kind": "collection"
        },
        {...}
      ]
    }
}

Link Objects

Each link object represents a related resource and has these properties:

Property Description

rel

Defines the relationship of the link object to the parent resource. Types of links include:

  • rel="self": Indicates how the resource is accessed currently. It is a link to itself.
  • rel="canonical": Provides the desired (preferred) link for the resource.
  • rel="child": Provides a link to a child resource.
  • rel="lov": Provides a link to a resource that contains the list of values used to set attribute values of the parent resource.
  • rel="parent": Provides a link back to the parent resource.

href

URL for accessing a related resource. It is an absolute and valid path.

name

Unique identifier for the link.

kind

Indicates the type of the related resource. Valid values are collection and item.

properties

An optional list of properties for the related resource.

Examples

Here's an example of a link object to the self resource (link to itself). This link references the self link for the employee.

{
  "items": [
    {
      "PersonId": 16590,
      "PersonNumber": "16590",
      "DateOfBirth": "1965-09-02",
      "links": [
        {
          "rel": "self",
          "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005",
          "name": "workers",
          "kind": "item",
          "properties": {
            "changeIndicator": "ACED0005737200136"
          }
        }
        {...}
      ]
    }
}

Here's an example of a link object to a child resource. This link references addresses, which is a child of the workers resource.

{
  "items": [
    {
      "PersonId": 16590,
      "PersonNumber": "16590",
      "DateOfBirth": "1965-09-02",
      "links": [
        {...},
        {
          "rel": "child",
          "href": "https://<host>::<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/addresses",
			   "name" : "addresses",
			   "kind": "collection"
        },
        {...}
      ]
    }
}