Labor API - Search Shifts returns different results in API Explorer and in Postman REST call

Hello! Hope to get a bit of help on this.

The Search Shifts endpoint at /v2/labor/shifts/search is working as-expected in the API Explorer. I’m able to set various parameters using the workday filter, or the start and end filters, and get only the shifts within a specific date range or timestamp range.

When I mimic this API call through a JavaScript fetch() request or in Postman (which I’ve been able to do for every other request I’ve tried, but haven’t tried others in the Labor-API), the API returns all shifts, ignoring the time filter, starting with the most current one, and going back for the maximum amount and provides a cursor to continue.

For instance, I want a specific pay period, so I add the 2 timestamps or dates to the request. In the API Explorer, I get the handful of staff I’ve selected, at the location I’ve selected, with shifts only in that timeframe.

When I copy the same query as presented in the node.js example, and convert the query data to JSON instead of a JavaScript object, I get the unbounded results. Whether through Postman, or my server-side fetch() function call.

From what I can tell, I’m afraid the API itself has a bug.

Any tips, duplication of the issue, or acknowledgement of a bug I could get would be great. Thanks!

1 Like

Hi @thoriumdesign welcome to the forums!

Can you share how you’re doing it in Postman or Javascript? I just tested SearchShifts in Postman and added a workday->date_range->start/end_date field, and it worked correctly. For example, in Postman I just have a JSON Body as:

{
  "query": {
    "filter": {
      "workday": {
        "date_range": {
          "start_date": "2018-11-01",
          "end_date": "2018-11-30"
        },
        "match_shifts_by": "START_AT",
        "default_timezone": "America/Los_Angeles"
      }
    }
  }
}