The following describes MTAPI-SRQL language: the MTOA Service Request Query Language used to perform filtering of Service Requests
via the “POST /api/v1/servicerequests/query” endpoint.
The MTAPI-SRQL language allows Service Request to be filtered using a set of filter type. The current supported types are:
Status
PlaceOfSupply
ServiceAttributes
RegulatedEntity-{REGULATED_ENTITY_ID}
Note the following use-cases are currently using the dataset available in MTOA-PLATFORM-TEST.
MITRACK USECASES
Query a list of Services by specifying the Service Ids in a comma delimited list
Because different services might not support the same Metadata fields, ExcludeMetadata must be set to true.
{ "Services":"230,231,232", "ExcludeMetadata": true, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25 }
Include the Regulated Entities data inside the dataset that contains a list of Service Requests
Query a single regulated entity such using an IMO number
The query needs to support full matches for the IMO number
{ "Services":"230,231,232", "ExcludeMetadata": true, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "RegulatedEntity-IMO='Value_2'" }
IMO could be replaced by any of the Regulated Entity Identifiers: {VESSEL_NM, CDN_SHIP_IND, IMO, OFFICIAL_NO}
That query needs to support partial matches for Vessel Names
{ "ServiceId": 230, "ExcludeMetadata": false, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "RegulatedEntity-VESSEL_NM.Contains('Value')" }
The .Contains('text') indicates partial matches.
Query a list of ServiceAttributes (by specifying the ServiceAttribute Ids in a comma delimited list)
{ "ServiceId": 2, "ExcludeMetadata": false, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "ServiceAttributes='98,99,100'" }
Query a list of ServiceRequest Statuses (by specifying the ServiceRequest Statuses in a comma delimited list)
{ "ServiceId": 2, "ExcludeMetadata": false, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "Status='Draft,InProgress,Submitted'" }
We should be able to use the filters in multiple permutations
ex1:
{ "ServiceId": 2, "ExcludeMetadata": false, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "Status='Draft,InProgress,Submitted' and ServiceAttributes='98,99,100'" }
ex2:
{ "UserId": 8872, "ExcludeMetadata": true, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "Status='Draft,InProgress' AND RegulatedEntity-IMO='Value_2'" }
ex3:
{ "UserId": 8872, "ExcludeMetadata": true, "IncludeRegulatedEntities": true, "Page": 1, "PageSize": 25, "Filter": "Status='Draft,InProgress' AND RegulatedEntity-IMO='Value_2' and PlaceOfSupply='ON'" }
However the following adding multiple variants of the same filter attribute is not permitted
"Filter": "RegulatedEntity-IMO='Value_2' AND RegulatedEntity-OFFICIAL_NO ='1234' "
The difference between this filter and the previous examples is that RegulatedEntity-IMO OR RegulatedEntity- OFFICIAL_NO are the same filter type RegulatedEntity
similarly:
"Filter": "Status='Draft’ OR Status=’InProgress’ is not supported but "Filter": "Status='Draft, InProgress’ is supported.
Know Issues
PlaceOfSupply is case sensitive
If an unsupported type is being used, it will be discarded .
Service Requests will be retrieving without taking that condition into account.