Apply filters to your findtime requests, to narrow the search-space.
Usually a search space defined only by beginning and end is not specific enough for your use-case. Most commonly physical resources are constrained by working or opening hours. Availability filters make it easy to add these constraints to your findtime requests.
Filter types
- OR filters
Will include the resulting timeslots from any of the supplied filters. If you supply two filters with timeslots that doesn't overlap, they will both be added to the result. Consider it equivalent of coding an OR in a conditional statement (Filter1Result OR Filter2Result OR Filter3Result ...).
Example:
"filters": {
"or": [
{"specific_day": {"day": "Monday"} },
{"specific_day": {"day": "Wednesday"} }
]
}
This will return time-slots only on Mondays and Wednesdays.
- AND filters
Will only include time-slots that fit within all of the supplied filters. Time-slots resulting from two different filters must overlap both filters to be included in the result. Consider it the equivalent of coding an AND in a conditional statement (Filter1Result AND Filter2Result AND Filter3Result ...)
Example
"filters": {
"and":[
{ "specific_time": {"start": 10, "end": 16} },
{ "specific_time": {"start": 12, "end": 18} }
]
}
This will return time-slots from 12 to 16, because this is the overlapping time-space.
Combined example:
"filters": {
"and":[
{ "specific_time": {"start": 10, "end": 16} },
{ "specific_time": {"start": 12, "end": 18} }
],
"or": [
{"specific_day": {"day": "Monday"} },
{"specific_day": {"day": "Wednesday"} }
]
}
This will return time-slots from 12 to 16 only on Mondays and Wednesdays.
Quicklinks
And/Or filters:
- Between timestamps
- Business hours
- Daytime
- Only weekend
- Exclude weekends
- Specific day and time
- Specific time
- Specific day
All filters example primarily meant as a quick syntax reference:
"filters": {
"or": [
{ "specific_day": {"day": "Monday"} },
{ "specific_day_and_time": {"day": "Wednesday", "start": 10, "end": 12, "timezone": "Europe/Copenhagen"}},
{ "between_timestamps": {"start": "2016-05-26T15:30:00+00:00", "end": "2016-05-28T18:00:00+00:00"}},
{ "exclude_weekend": {} },
{ "only_weekend": {} },
{ "specific_time": {"start": 9, "end": 15} }
],
"and": [
{ "business_hours": {"timezone": "America/Los_angeles"} },
{ "daytime": {"timezone": "Europe/Copenhagen"}}
]
}
Between timestamps filter
Limit the search-space to between two timestamps.
Argument | Description | Required | Example |
---|---|---|---|
start | The start timestamp of the filter | yes | "2016-05-26T15:30:00+00:00" |
end | The end timestamp of the filter | yes | "2016-05-28T18:00:00+00:00" |
timezone | Set timezone | no | "Europe/Copenhagen" |
"filters": {
"and": [
{ "between_timestamps": {
"start": "2016-05-26T15:30:00+02:00",
"end": "2016-05-28T18:00:00+02:00",
"timezone": "Europe/Copenhagen"}
}
]
}
Adding availability instead of blocking out.
The between-timestamps filter can be used as a way to add availability, so instead of blocking anything off like you would normally do, you supply a list of between-timestamps as or-filters, defining the time-slots you want bookable.
Business hours filter
Can be used to find all solutions in business hours (9 - 18 (6pm)) in a specific timezone.
Argument | Description | Required | Example |
---|---|---|---|
timezone | The timezone the business should be in | no - Default will be the timezone in the request headers | "America/Los_angeles" |
"filters": {
"and": [
{ "business_hours": {"timezone": "America/Los_angeles"} },
{ "business_hours": {"timezone": "Europe/Copenhagen"} }
]
}
You can add more than 1 business hour filter!
If you add two business-hour as 'and' filters with two different timezones, you can make sure both timezones are in business hours! This will be useful if you need to set up a meeting between two resources working in different timezones.
Daytime filter
Will only show options where its daytime (7 - 23 (11pm)) in the given timezone
Argument | Description | Required | Example |
---|---|---|---|
timezone | The timezone the business should be in | no - Default will be the timezone in the request headers | "America/Los_angeles" |
"filters": {
"and": [
{ "daytime": {"timezone": "America/Los_angeles"} },
{ "daytime": {"timezone": "Europe/Copenhagen"} }
]
}
Exclude weekends filter
If you need to filter out weekends (Saturdays & Sundays) you can use this filter. It takes a single argument
Argument | Description | Required | Example |
---|---|---|---|
timezone | The timezone | no - default is the timezone in the header request | "Europe/Copenhagen" |
"filters": {
"and": [
{ "exclude_weekend": {}}
]
}
Only weekend filter
If you only need time-slots in the weekend use this filter. The filter takes a single argument:
Argument | Description | Required | Example |
---|---|---|---|
timezone | Only weekend of the given timezone | no - default is the timezone in the header request | "Europe/Copenhagen" |
This simple filter will only give you time-slots during weekends.
"filters": {
"and": [
{ "only_weekend": {}}
]
}
Specific day and time filter
If you only need time-slots for a specific day and time, you can use this filter. The filter takes 3 argument:
Argument | Description | Required | Example |
---|---|---|---|
day | The day you need timeslots for | yes | "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" or "Sunday" |
start | The start hour for this filter (in 24 hour format) | yes | 10 |
end | The end hour for this filter (in 24 hour format) | yes | 16 |
"filters": {
"and": [
{ "specific_day_and_time": {"day": "Monday", "start": 10, "end": 16}}
]
}
This will give you all time-slots on Mondays between 10 & 16.
Specific time filter
If you only need timeslots for a specific time interval, you can use this filter. The filter takes a single argument:
Argument | Description | Required | Example |
---|---|---|---|
start | The start hour for this filter (in 24 hour format) | yes | 10 |
end | The end hour for this filter (in 24 hour format) | yes | 16 |
timezone | That timezone the start & end hour should make | no - default from the request headers | "Europe/Copenhagen" |
"filters": {
"and": [
{ "specific_time": {"start": 10, "end": 16}}
]
}
Specific day filter
If you only need timeslots for a specific day, you can use this filter. The filter takes a single argument:
Argument | Description | Required | Example |
---|---|---|---|
day | The day you need timeslots for | yes | "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" or "Sunday" |
"filters": {
"and": [
{ "specific_day": {"day": "Monday"}}
]
}