Verify
To save processing time and payload size, you can store the resource on the client and conditionally retrieve and verify the resource only if modifications occurred. This can be achieved using the ETag infrastructure.
-
Obtain the ETag value. For a GET operation on a singular resource, the server returns this value as the ETag response header. The ETag value is also available in the link properties as a
changeIndicator
.Request
GET
/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/names/00020000000EACED0005?fields=DisplayName&links=self
Response
200 OK Etag: "ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D" { "DisplayName": "Erin Mack", "links": [ { "rel": "self", "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/names/00020000000EACED0005", "name": "names", "kind": "item", "properties": { "changeIndicator": "ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D" } } ] }
-
Save the returned ETag value and use it in subsequent GET requests with the If-None-Match request header. This header indicates that the server returns a response only if the resource was modified.
Request
GET
/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED00057708000000005?fields=DisplayName&onlyData=true
If-None-Match: "ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D"
Response
If the resource wasn't modified, the server acknowledges the request and does not return a response body.
304 Not modified
If the resource was modified, the server returns the current representation of the resource and the new ETag value. Save this ETag value for subsequent calls.
200 OK Etag: "FCED00057372000000014770400000014737A76612E6C616E672E4" { "DisplayName": "Erin D Mack", "links": [ { "rel": "self", "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/00020000000EACED0005/child/names/00020000000EACED0005", "name": "names", "kind": "item", "properties": { "changeIndicator": "FCED00057372000000014770400000014737A76612E6C616E672E4" } } ] }