Sort Workers by Display Name
Let's say
that as a Line Manager, David wants to retrieve his reports sorted
by display name in the ascending order. In this example, David performs
a GET operation on the parent workers resource using the fields parameter.
Note that
you can't retrieve name-specific attributes such as DisplayName, ListName and FullName attributes in the default
or minimal shape of the parent workers resource. You can retrieve them from the names child resource, which supports
the complete functionality of the names object.
To retrieve workers sorted by their display name in ascending order:
- Perform a GET operation on the
workersresource by using thefieldsparameter to extract the detailed definition of the resource. - Verify the details returned in the response.
Example URL
Use this resource URL format.
GET/hcmRestApi/resources/11.13.18.05/workers?fields=PersonNumber,DisplayName&orderBy=DisplayName:asc&onlyData=trueExample Response
Here's an example of the response body in JSON format.
{
"items": [
{
"PersonNumber": "39226",
"DisplayName": "Andy Blake"
},
{
"PersonNumber": "39251",
"DisplayName": "David Lee"
},
{
"PersonNumber": "39276",
"DisplayName": "Eugene Wei"
}
...]
}Example URL
Use this resource URL format.
GET/hcmRestApi/resources/11.13.18.05/workers?fields=%2BDisplayName&orderBy=DisplayName:asc&onlyData=trueExample Response
Here's an example of the response body in JSON format.
{
"items": [
{
"PersonId": 300100031854233,
"PersonNumber": "955160008176641",
"CorrespondenceLanguage": null,
"BloodType": null,
"DateOfBirth": null,
"DateOfDeath": null,
"CountryOfBirth": null,
"RegionOfBirth": null,
"TownOfBirth": null,
"ApplicantNumber": null,
"CreatedBy": "FUSION",
"CreationDate": "2013-12-22T21:35:10+00:00",
"LastUpdatedBy": "FUSION",
"LastUpdateDate": "2013-12-22T21:35:46.782+00:00",
"DisplayName": Andy Blake""
},
{
"PersonId": 18924,
"PersonNumber": "18924",
"CorrespondenceLanguage": null,
"BloodType": null,
"DateOfBirth": "1966-06-11",
"DateOfDeath": null,
"CountryOfBirth": null,
"RegionOfBirth": null,
"TownOfBirth": null,
"ApplicantNumber": null,
"CreatedBy": "1006911",
"CreationDate": "2004-09-27T14:21:30+00:00",
"LastUpdatedBy": "1384",
"LastUpdateDate": "2005-05-25T16:20:39+00:00",
"DisplayName": "David Lee"
},
...]
}