Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Executes query on service requests.

Description

Executes a query on service requests by providing a ServiceRequest object which contain parameters to filter the results by the place of supply and/or the status.

...

Interface

IServiceRequestManager

Syntax

Task<ICollection<ServiceRequest>> ExecuteQuery<T>(ServiceRequestQuery serviceRequestQuery)

Returns

Task<ICollection<ServiceRequest>>

API Endpoint

[POST] /api/servicerequests/query

...

Sample request body - filtering by place of supply and status for service id 11.

Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

Code Block
languagejson
{
  "UserId": 0,
  "ServiceId": 11,
  "OrganizationId": 0,
  "ExcludeMetadata": false,
  "Page": 1,
  "PageSize": 25,
  "Filter": "PlaceOfSupply='ON' AND Status='InProgress'",
  "Version": 1
}

Sample request body - filtering by place of supply for service id 11.

Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

Code Block
languagejson
{
  "UserId": 0,
  "ServiceId": 11,
  "OrganizationId": 0,
  "ExcludeMetadata": false,
  "Page": 1,
  "PageSize": 25,
  "Filter": "PlaceOfSupply='ON'",
  "Version": 1
}

Sample request body - filtering by status for service id 11.

Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

Code Block
languagejson
{
  "UserId": 0,
  "ServiceId": 11,
  "OrganizationId": 0,
  "ExcludeMetadata": false,
  "Page": 1,
  "PageSize": 25,
  "Filter": "Status='InProgress'",
  "Version": 1
}

...

400 Bad Request - Service requests couldn’t could not be retrieved

Example - Filtering by place of supply and status

Code Block
languagec#
//This is an exemple of a query using filtering for the place of supply and status.
//This will filter all service requests for service id 11.
//Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

const ServiceRequestStatus status = ServiceRequestStatus.InProgress;
const string province = "ON";
var query = new ServiceRequestQuery
{
    ServiceId = ServiceId,
    Page = 1,
    PageSize = 25,
    Version = 1.0F,
    Filter = $"PlaceOfSupply='{province}' AND Status='{status}'"
};
            
// Get all service requests with metadata using the place of supply and status filter.
var requestWithMetadata = await serviceRequestManager.ExecuteQuery<ServiceRequestMetadata>(query);

// Get all service requests without metadata using the place of supply and status filter.
var requestsNoMetadata = await serviceRequestManager.ExecuteQuery<NoMetadata>(query);

...

Code Block
languagec#
//This is an exemple of a query using filtering for the place of supply and status.
//This will filter all service requests for service id 11.
//Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

const string province = "ON";
var query = new ServiceRequestQuery
{
    ServiceId = ServiceId,
    Page = 1,
    PageSize = 25,
    Version = 1.0F,
    Filter = $"PlaceOfSupply='{province}'"
};
            
// Get all service requests with metadata using the place of supply and status filter.
var requestWithMetadata = await serviceRequestManager.ExecuteQuery<ServiceRequestMetadata>(query);

// Get all service requests without metadata using the place of supply and status filter.
var requestsNoMetadata = await serviceRequestManager.ExecuteQuery<NoMetadata>(query);

...

Code Block
languagec#
//This is an exemple of a query using filtering for the place of supply and status.
//This will filter all service requests for service id 11.
//Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

const ServiceRequestStatus status = ServiceRequestStatus.InProgress;
var query = new ServiceRequestQuery
{
    ServiceId = ServiceId,
    Page = 1,
    PageSize = 25,
    Version = 1.0F,
    Filter = $"Status='{status}'"
};
            
// Get all service requests with metadata using the place of supply and status filter.
var requestWithMetadata = await serviceRequestManager.ExecuteQuery<ServiceRequestMetadata>(query);

// Get all service requests without metadata using the place of supply and status filter.
var requestsNoMetadata = await serviceRequestManager.ExecuteQuery<NoMetadata>(query);

...

Name

Type

Description

UserId

Integer

User id associated to service request. Default value is 0.

ServiceId

Integer

Service id associated to service request. Default value is 0.

OrganizationId

Integer

Organization id associated to service request. Default is 0.

Note: You cannot use the UserId, ServiceId and OrganizationId at the same time. Only one, or two of them can be used at the same time.

ExcludeMetadata

Boolean

True to include the service request meta data be included in the result.

False to exclude the service request meta data be included in the result.

Page

Integer

The page number. If the value provided is 0 then it will default to 1.

PageSize

Integer

The page size. If the value provided is 0 then it will default to 25.

Filter

String

This is used to filter the results by place of supply and/or status.

Note:
No filtering will be done if the value is empty

Place of supply
To filter the place of supply use this filter: "PlaceOfSupply='ON'"

Note:
The text must be used as provided and is not case sensitive. The province code must be two letters in between single quotes.

Possible values:
Valid values are in upper case:

  • AB, BC, MB, NB, NL, NS, NT, NU, ON, PE, QC, SK, YT


Status
To filter the status use this filter: “Status='InProgress'".

Note:
The text must be used as provided and is not case sensitive. The status must be in between single quotes

Possible values for service request statuses.

  • InProgress

  • Submitted

  • InReview

  • Completed

  • TrainingCompleted

  • InformationRequired

  • Accepted

  • AcceptedWithUpdates

  • Canceled

  • Initiated

  • Expired

  • Rejected

  • Failed

  • PickedUp

  • TestPaymentPending

  • TestPaymentSent

  • Validated

  • Verified

  • Approved

  • OnHold

  • PendingApproval

  • DocumentIssued

  • Draft

  • Assigned

  • Updated

  • ActivityPlanned

  • Closed

  • ActivityCompleted

  • DeclarationSubmitted


Place of supply and status
Both filters can be used at the same time.

Example:
"PlaceOfSupply='ON' AND Status='InProgress'"

Version

Number

Filter version number. Value should be set to: 1.

This is currently only used for logging purposes.

...