GetByServices()
Description
Gets a list of service requests by services. This list allows for pagination if a page or page size is provided. Service requests can be excluded.
Package Details
Interface
IServiceRequestManager
Syntax
Task<ICollection<ServiceRequest>> GetByServices<T>(ICollection<int> serviceIds, int page, int pageSizes, bool includeRegulatedEntities) where T : IServiceRequestMetadata;
Returns
ICollection<ServiceRequest>
API
/api/v1/servicerequests
Parameters
Parameter | Description | Parameter Type |
---|---|---|
services (required) | Coma delimited list of service ids we want to retrieve service requests for. | query |
page | Specific page to retrieve. | query |
pageSize | Size of the page to retrieve. | query |
excludeMetadata | Exclude the Service Request metadata. Default value is false. | query |
excludeServiceRequests | Exclude all the Service Requests (used to retrieve the Service Request count). Default value is false. | query |
includeRegulatedEntities | True if the Service Request payload should contain its associated regulated entities, false otherwise. Default value is false. | query |
Returns
200 - OK
Returns a list of service requests, the count of service requests found, page number and if there’s more records.
Sample JSON (with regulated entities)
{
"ServiceRequests": [
{
"Id": 1000,
"Guid": "01806ab5-895d-4b65-8e7b-1320e8620bd0",
"UserId": 1234,
"ServiceId": 230,
"OrganizationId": null,
"RequestStatus": "Submitted",
"EnglishDisplayName": "Sample",
"FrenchDisplayName": "Sample",
"MetadataStructureId": null,
"ServiceAttributeId": null,
"Comment": "Comments",
"RequesterId": null,
"MailCoordinateId": null,
"PlaceOfSupply": "ON",
"RequesterOrganizationId": null,
"ServiceStandardId": 0,
"Metadata": null,
"RegulatedEntities": [
{
"Value": "Value",
"ServiceId": 230,
"RegulatedEntityTypeCode": "VESSEL",
"RegulatedEntityIdTypeCode": "VESSEL_NM",
"SortOrder": 1,
"EnglishDisplayName": "Vessel Name",
"FrenchDisplayName": "Nom du bâtiment"
},
{
"Value": "Value",
"ServiceId": 230,
"RegulatedEntityTypeCode": "VESSEL",
"RegulatedEntityIdTypeCode": "CDN_SHIP_IND",
"SortOrder": 2,
"EnglishDisplayName": "Canadian Vessel?",
"FrenchDisplayName": "Bâtment canadien?"
},
{
"Value": "12345678910",
"ServiceId": 230,
"RegulatedEntityTypeCode": "VESSEL",
"RegulatedEntityIdTypeCode": "IMO",
"SortOrder": 3,
"EnglishDisplayName": "IMO",
"FrenchDisplayName": "OMI"
},
{
"Value": "78910654321",
"ServiceId": 230,
"RegulatedEntityTypeCode": "VESSEL",
"RegulatedEntityIdTypeCode": "OFFICIAL_NO",
"SortOrder": 4,
"EnglishDisplayName": "Official No.",
"FrenchDisplayName": "Numéro officiel"
}
],
"DateUpdatedUtc": "2021-06-09T11:44:28",
"DateUpdated": "2021-06-09T07:44:28"
}
],
"Count": 1,
"Page": 1,
"HasMore": true
}
No results found
{
"ServiceRequests": [],
"Count": 0,
"Page": 1,
"HasMore": false
}
400 - Bad Request
"Message": "Services:{id} couldn't be retrieved."
Example