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 |
---|---|
|
Defines the relationship of the link object to the parent resource. Types of links include:
|
|
URL for accessing a related resource. It is an absolute and valid path. |
|
Unique identifier for the link. |
|
Indicates the type of the related resource. Valid values are collection and item. |
|
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"
},
{...}
]
}
}