Find and Filter Work Orders

1 minute read

Find Work Orders by Status

Sometimes you may need to filter created WOs by a status. Use this request to get a list of work order IDs with a certain status. In the example below, we get WOs with the OPEN primary status.

GET /odata/workorders?$select=Id&$filter=Status/Primary eq {Status.Primary}

Parameter Parameter type Example value
$select Query Id
$filter Query Status/Primary eq ‘OPEN’

Example request:

GET https://sb2api.servicechannel.com/v3/odata/workorders?$select=Id&$filter=Status/Primary%20eq%20%27OPEN%27 HTTP/1.1
Authorization: Bearer {access_token}

Example response:

{
  "@odata.context": "http://sb2api.servicechannel.com/v3/odata/$metadata#workorders(Id)",
  "value": [
    {
      "Id": 85372353
    },
    {
      "Id": 85530821
    },
    "..."
  ],
  "@odata.nextLink": "http://sb2api.servicechannel.com/v3/odata/workorders?$select=Id&$filter=Status%2FPrimary%20eq%20'OPEN'&$skip=50"
}

Response code: HTTP/1.1 200 OK

Get a Work Order by ID

When you want to get detailed information on the WO you have just created or see what is going on with some other WO, send the following request:

GET /odata/workorders?$filter=Id eq {workorderId}

Parameter Parameter type Example value
$filter Query Id eq 88472932

Example request:

GET https://sb2api.servicechannel.com/v3/odata/workorders?$filter=Id%20eq%2088472932 HTTP/1.1
Authorization: Bearer {access_token}

Example response:

{
  "@odata.context": "http://sb2api.servicechannel.com/v3/odata/$metadata#workorders",
  "value": [
    {
      "Id": 88472932,
      "Number": "88472932",
      "PurchaseNumber": "88472932",
      "Status": {
        "Primary": "OPEN",
        "Extended": null
      },
      "Caller": "SC-Dev1",
      "CreatedBy": "SC-Dev1",
      "CallDate": "2017-09-26T21:20:20-04:00",
      "ReassignDate": null,
      "Priority": "P2 - 8 Hours",
      "Trade": "HVAC",
      "ApprovalCode": null,
      "ScheduledDate": "2017-09-28T21:20:20-04:00",
      "CompletedDate": null,
      "ExpirationDate": "2017-09-28T21:20:20-04:00",
      "UpdatedDate": "2017-09-28T07:08:05.92-04:00",
      "Description": "Test description",
      "Category": "CAPEX",
      "Nte": 110
    }
  ]
}

Response code: HTTP/1.1 200 OK

Updated: