Collection Resources

A collection resource represents a list of items, such as a list of workers or jobs. It has these features:

  • Includes an array of singular resources of the same type.
  • Extends a singular resource using the links property.
  • Supports requests in parts so that you can implement a paginated response. The client can get a part of the collection in one request, followed by multiple subsequent requests for the next or previous part. To support this navigation, the links section can include links to the previous page and next page.
  • Functions either as a root resource or a sub resource.
  • Enables the client to use the orderBy command to specify an order for the items returned. Otherwise, the order can't be determined.

Each collection resource is defined by these properties:

Property Description

items

An array of items in the collection. Each item is a singular resource.

hasMore

A Boolean value that indicates whether there are more items to be retrieved. Valid values are:

  • true which indicates there are more values to retrieve.
  • false which indicates there are no more values to retrieve.

totalResult

An integer value that specifies the total number of resource instances in the response. It includes the instances in the current response and the instances yet to be retrieved.

limit

An integer value that specifies the paging size that the server uses for a client request. The default value is 25. The server might override this value to improve application performance.

The maximum value for this parameter is 499. If you specify a value more than 499, only the first 499 records are returned and the hasMore parameter is false.

count

An integer value that specifies the number of items in the paging response. This value matches the value in the items parameter.

offset

An integer value that specifies the index of the first item to be returned. The default value is 0. For example:

  • If offset =0, the response contains all the items, starting from the first item in the collection.
  • If offset =10 and count =20, the response contains resources from 11 to 30.

Examples

Here's an example of a collection resource for workers. The items array contains the singular resource (worker).

{
  {    
  "items":[
   {
    "PersonId": 300100215315227,
    "PersonNumber": "960000000000900",
    "CorrespondenceLanguage": null,
    "BloodType": null,
    "DateOfBirth": null,
    "DateOfDeath": null,
    "CountryOfBirth": null,
    "RegionOfBirth": null,
    "TownOfBirth": null,
    "ApplicantNumber": null,
    "CreatedBy": "VMOSS",
    "CreationDate": "2019-04-23T10:25:40+00:00",
    "LastUpdatedBy": "VMOSS",
    "LastUpdateDate": "2019-04-23T10:25:44.457+00:00",
    "workRelationships": {
        "items": [
            {
                "PeriodOfServiceId": 300100215315230,
                "LegislationCode": "US",
                "LegalEntityId": 100000011593283,
                "LegalEmployerName": null,
                "WorkerType": "E",
                "PrimaryFlag": true,
                "StartDate": "2018-01-01",
                "LegalEmployerSeniorityDate": null,
                "EnterpriseSeniorityDate": null,
	              ...
	  "links" : [
       {
		     ...
			{
				"rel" : "child",
				"href" : "http://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers/44617465686A81014B597419030/child/visasPermits",
				"name" : "visasPermits",
				"kind" : "collection"
		}
		}]
	}, 
	{"names": {
        "items": [
            {
                "PersonNameId": 300100215315228,
                "EffectiveStartDate": "2018-01-01",
                "EffectiveEndDate": "4712-12-31",
                "LegislationCode": "US",
                "LastName": "Doe",
                "FirstName": "John",
                "PreNameAdjunct": null,
                "Suffix": null,
                "MiddleNames": null,
                "DisplayName": "John Doe",
                "OrderName": "John Doe",
                "ListName": "John Doe",
                "FullName": "John Doe",
                "NameLanguage": "US",
                "CreatedBy": "VMOSS",
                "CreationDate": "2019-04-23T10:25:40.022+00:00",
                "LastUpdatedBy": "VMOSS",
                "LastUpdateDate": "2019-04-23T10:25:44.464+00:00",
                "LocalPersonNameId": 300100215315229,
                "LocalEffectiveStartDate": "2018-01-01",
                "LocalEffectiveEndDate": "4712-12-31",
                "LocalLegislationCode": "US",
                "LocalLastName": "Doe",
                "LocalFirstName": null,
                "LocalPreNameAdjunct": null,
                "LocalSuffix": null,
                "LocalMiddleNames": null,
                "LocalDisplayName": "John Doe",
                "LocalOrderName": "John Doe",
                "LocalListName": "John Doe",
                "LocalFullName": "John Doe",
                "LocalNameLanguage": "US",
                "LocalCreatedBy": "VMOSS",
                "LocalCreationDate": "2019-04-23T10:25:40.022+00:00",
                "LocalLastUpdatedBy": "VMOSS",
                "LocalLastUpdateDate": "2019-04-23T10:25:44.465+00:00",
                "links": [
                   {...
                      }
	],
  "count" : 4,
  "hasMore" : true,
  ...
}

Here's an example of the attributes of the collection resource. You can use these attributes to navigate the collection.

{
  "items" : [ {
    "PersonId": 300100215315227,
    "PersonNumber": "960000000000900",
    "CorrespondenceLanguage": null,
    "BloodType": null,
    "DateOfBirth": null,
    "DateOfDeath": null,
    "CountryOfBirth": null,
    "RegionOfBirth": null,
    "TownOfBirth": null,
    "ApplicantNumber": null,
    "CreatedBy": "VMOSS",
    "CreationDate": "2019-04-23T10:25:40+00:00",
    "LastUpdatedBy": "VMOSS",
    "LastUpdateDate": "2019-04-23T10:25:44.457+00:00",
  }, {
    "PersonId": 300100215314929,
    "PersonNumber": "960000000000897",
    "CorrespondenceLanguage": null,
    "BloodType": null,
    "DateOfBirth": "1987-01-01",
    "DateOfDeath": null,
    "CountryOfBirth": "US",
    "RegionOfBirth": null,
    "TownOfBirth": null,
    "ApplicantNumber": null,
    "CreatedBy": "VMOSS",
    "CreationDate": "2019-04-23T10:01:58+00:00",
    "LastUpdatedBy": "VMOSS",
    "LastUpdateDate": "2019-04-23T11:01:13.018+00:00",
  },
  .....
  ],
  "totalResults" : 9,
  "count" : 6,
  "hasMore" : true,
  "limit" : 6,
  "offset" : 0,
  "links" : [ {
    "rel" : "self",
	"href" : "http://<host>:<port>/hcmRestApi/resources/11.13.18.05/workers",
    "name" : "workers",
    "kind" : "collection"
  } ]
}