Creating a sample request
For this example, REST API definitions for the Person and Department BOs should have been created and published. The OpenAPI documents should have been imported in – for example – Postman. If that has not yet been done, go back to Multi-level definitions and follow the steps from there.
In this sample request, we are looking for a person named John who works for us.
For this request, the /read endpoint should be used.
You can filter on FirstName is John, and EndDate is not filled in.
The complete request then looks like this:
{
"filter": {
"FirstName": {
"eq": "John"
},
"EndDate": {
"exists": false
}
}
}
The answer we receive might contain quite a number of people that have ‘John’ as their first name. The response will resemble this:
{
"records": [
{
"Code": "422",
"DepartmentRef": {
"Code": "04",
"CompositeCode": "04",
"IsArchived": false,
"Name": "ICT",
"SysAccountRef": 1,
"Syscode": 10,
"SysMutationDateTime": "2020-09-10T00:04:14+01:00",
"SysUpdateCount": 0
},
"Email": "John.Servicedesk@planon.co.uk",
"FirstName": "John",
"FTEFactor": 1,
"IsAnonymized": false,
"IsArchived": false,
"LastName": "Servicedesk",
"MutationDate": "2020-09-09",
"PhoneNumber": "+44 (0) 2075016123",
"PropertyRef": 3,
"Syscode": 149,
"SysInsertDateTime": "2020-09-10T00:06:39+01:00",
"SysMutationDateTime": "2020-09-10T00:32:42+01:00",
"SysUpdateCount": 2
},
{...<data for another person>...
},
...
{...<data for another person>...
}
]
}
If you know the department John works for, you can reduce the number of results.
John works for ICT. As the Person and Department definitions are linked, a nested search can be done. In nested searches, the syscode has to be used as the search value. The syscode of the ICT department is 10, so the requests can now we refined into:
{
"filter": {
"FirstName": {
"eq": "John"
},
"EndDate" : {
"exists": false
},
"DepartmentRef" : {
"eq": "10"
}
}
}
This query will reduce the results so that John can more easily be found.
More examples can be found in the section Sample usage of the endpoints.