Overview
There are a few ENDPOINTS which exeute a bulk search using a POST request and json strut.
The above endpoint has will search for Appointments.
The struts have a common format.
We have common properties FilterGroups which is a collection of Filters, Sorts, Limit and After.
Limit and After
Both limit
and after
properties allow paging a results set and must be an iteger,
{
"sorts": [
{
"propertyName": "appointmentId",
"direction": "asc"
}
],
"limit": 5,
"after": 0
}
The above example returns 5 Appointments ordered by the appointmentId
field.
To get the next page increment the after
property.
{
"sorts": [
{
"propertyName": "appointmentId",
"direction": "asc"
}
],
"limit": 5,
"after": 5
}
Sorts
This field allows the modification to the order of the results but please note only a limited subset of properties are supported.
"sorts": [
{
"propertyName": "appointmentId",
"direction": "asc"
},
{
"propertyName": "scheduledDate",
"direction": "desc"
}
]
The direction
property has two values either asc or
desc`.
Filter Groups
This property populates the WHERE clause of the query but plese note that only a limited set of properties are available for use.
A filter
strut has three properties, propertyName
, value
, operator
.
The propertyName
is required to match one of the properties in the entity and value
is a string representation.
{
"filterGroups": [
{
"filters": [
{
"propertyName": "appointmentId",
"value": "30013",
"operator": "EQ"
}
]
}
],
"sorts": [
{
"propertyName": "appointmentId",
"direction": "asc"
},
{
"propertyName": "scheduledDate",
"direction": "desc"
}
],
"limit": 0,
"after": 0
}
A struct like above searches for an Appointment by its id
, if using id
please don’t include value in after
property or leave it with value of 0.
{
"filterGroups": [
{
"filters": [
{
"propertyName": "appointmentId",
"value": "30022",
"operator": "EQ"
}
]
},
{
"filters": [
{
"propertyName": "appointmentId",
"value": "30013",
"operator": "EQ"
}
]
}
],
}
To fetch two Appointments see the above query there are two filter
objects under filterGroups
which creates an OR condition between both of the filters,
in sql looks like WHERE (appointmentId = 3022) OR (appointmentId = 2013)
.
{
"filterGroups": [
{
"filters": [
{
"propertyName": "appointmentId",
"value": "30022",
"operator": "EQ"
},
{
"propertyName": "completionStatusCode",
"value": "A",
"operator": "EQ"
}
]
},
{
"filters": [
{
"propertyName": "appointmentId",
"value": "30013",
"operator": "EQ"
}
]
}
],
}
If appointment A3022 was to be returned if it’s status was Assigned only we could use query like the above which translate to WHERE (appointmentId = 3022 and status = 'A') OR (appointmentId = 2013)
When there is multiple filter
objects that are memebers of the same filters collection
these are converted to an AND condition.
When using Date Values they are expected to be converted to string in a timestamps format e.g YYYY-MM-DD HH24:MI:SS
.
"filters": [
{
"propertyName": "scheduledDate",
"value": "2023-05-22T13:00:00",
"operator": "EQ"
}
]
The above example would search for appointments scheduled on the date 2023-05-22 at 1pm
.
The Operator property supports the following actions:
Action | Description |
---|---|
EQ | Equals |
NEQ | Not Equals |
LT | Less Than |
LTE | Less Than Equal |
GT | Greater Than |
GTE | Greater Than Equal |
ISNULL | Is equal to Null or empty string |
ISNOTNULL | Is not Null or empty string |
CONTAINS_TOKEN | An sql like query |
NOTCONTAINSTOKEN | not match the sql like query |
Supported Endpoints
For the endpoint /{instance}/appointments/search
Filters include: appointmentId, customerId, fieldworkerId, workTypeId completionStatusCode, completionSubStatusCode, invoiceStatsCode, submissionStatusCode scheduledDate, completedDate, actualCompletedDate, modifiedDate, invoiceEligibilityDate, submissionEligibilityDate, clientInvoiceEligibilityDate, activityDate commencementDate
Sort include: appointmentId
For the endpoint /{instance}/customers/search
Filters include: customerId, customerRef, companyName, taxId, email, mobilePhone, firstname, surname , state, suburb, postCode
Sort include: customerId
For the endpoint /{instance}/jobs/search
Filters include: jobId, customerId, agentId, trackingCode, salesPipelineStageId, agentName , statusCode, statusDescription creationDate, sourceId, source, sourceAssociateId, sourceAssociate, quotationStatusDate, quotationStatus assessmentStatus, assessmentSubStatus, installationStatus, installationSubStatus, clientId
Sort include: jobId