Search Shifts

This endpoint allows for the efficient searching and filtering of shift records based on specified query parameters such as title, timing, capacity, opportunity, category, and created date. It is designed to support operations that require accessing detailed shift information quickly and effectively.

Endpoint and Usage:

Endpoint: GET /api/shifts/search/

Base URL: https://api.vomevolunteer.com

Query Parameters:

Core Filters

  • id (uuid): Filters shifts by ID.

  • title (string): Filters shifts by title.

  • shift_title (string): Alias for title.

  • description (string): Filters shifts by description.

  • shift_description (string): Alias for description.

  • created_at (string, ISO-8601): Filters shifts by exact created_at.

  • created_at.gt (string, ISO-8601): Filters by created_at > value.

  • created_at.gte (string, ISO-8601): Filters by created_at >= value.

  • created_at.lte (string, ISO-8601): Filters by created_at <= value.

  • created_at.lt (string, ISO-8601): Filters by created_at < value.

  • created_date (string, ISO-8601 date): Filters by the date portion of created_at.

  • created_on (string, ISO-8601 date): Alias for created_date.

  • created_date.gt / created_on.gt: Filters by created date greater than value.

  • created_date.gte / created_on.gte: Filters by created date greater than or equal to value.

  • created_date.lt / created_on.lt: Filters by created date less than value.

  • created_date.lte / created_on.lte: Filters by created date less than or equal to value.

  • ordering (string): Sorts results by created_at, shift_start_at, shift_end_at, or spots, in ascending or descending order.

Shift Timing Filters

  • shift_date (string, ISO-8601 date): Filters by the date portion of shift_start_at.

  • date (string, ISO-8601 date): Alias for shift_date.

  • shift_date.gt / date.gt: Filters by shift date greater than value.

  • shift_date.gte / date.gte: Filters by shift date greater than or equal to value.

  • shift_date.lt / date.lt: Filters by shift date less than value.

  • shift_date.lte / date.lte: Filters by shift date less than or equal to value.

  • shift_start_at (string, ISO-8601): Filters by exact shift start timestamp.

  • shift_start_at.gt, shift_start_at.gte, shift_start_at.lt, shift_start_at.lte: Range filters for shift start timestamp.

  • shift_start_time (string): Filters by the time portion of shift_start_at.

  • start_time (string): Alias for shift_start_time.

  • shift_start_time.gt, shift_start_time.gte, shift_start_time.lt, shift_start_time.lte: Range filters for shift start time.

  • shift_end_at (string, ISO-8601): Filters by exact shift end timestamp.

  • shift_end_at.gt, shift_end_at.gte, shift_end_at.lt, shift_end_at.lte: Range filters for shift end timestamp.

  • shift_end_time (string): Filters by the time portion of shift_end_at.

  • end_time (string): Alias for shift_end_time.

  • shift_end_time.gt, shift_end_time.gte, shift_end_time.lt, shift_end_time.lte: Range filters for shift end time.

Capacity Filters

  • spots (integer): Filters shifts by exact spot count.

  • spots.gt (integer): Filters shifts by spots > value.

  • spots.gte (integer): Filters shifts by spots >= value.

  • spots.lt (integer): Filters shifts by spots < value.

  • spots.lte (integer): Filters shifts by spots <= value.

Opportunity and Category Filters

  • opportunity.id (uuid): Filters by related opportunity ID.

  • opportunity_id (uuid): Alias for opportunity.id.

  • opportunity.title (string): Filters by related opportunity title.

  • opportunity_title (string): Alias for opportunity.title.

  • category.id (uuid): Filters by related category ID.

  • category_id (uuid): Alias for category.id.

  • category.title (string): Filters by related category title.

  • category_title (string): Alias for category.title.

Sample Requests

Authorization:

Requests to this endpoint require an API-KEY in the header for authentication.

Response Structure:

The response from this endpoint returns a paginated list of shifts that match the query parameters, including timing, spot counts, and the public share URL for each shift.

Example Response Object:

Example Response Structure

Summary Information

  • count: Total number of matching shifts.

  • next: URL for the next page of results, or null.

  • previous: URL for the previous page of results, or null.

Shift Object

  • id: Unique ID of the shift.

  • created_at: Created timestamp of the shift.

  • shift_start_at: Start timestamp of the shift.

  • shift_end_at: End timestamp of the shift.

  • spots: Total shift capacity.

  • spots_reserved: Number of currently filled spots.

  • spots_available: Number of remaining spots.

  • opportunity: Related opportunity role object with nested category data.

  • shift_location: Derived display location for the shift.

  • shift_title: Stored shift title.

  • shift_description: Stored shift description.

  • share_shift_url: Public share URL for the shift.

  • title: Alias of shift_title.

  • description: Alias of shift_description.

Validation Rules

  • Invalid date, datetime, time, or integer values return 400 Bad Request.

  • ordering only accepts created_at, -created_at, shift_start_at, -shift_start_at, shift_end_at, -shift_end_at, spots, or -spots.

  • If no ordering is supplied, results default to shift_start_at, then created_at.

Example validation error:

Last updated