All URIs are relative to https://api.wheniwork.com/2
| Method | HTTP request | Description |
|---|---|---|
| get_positions | GET /positions | |
| get_shift | GET /shifts/{shift-id} | |
| get_shifts | GET /shifts | |
| get_times | GET /times | |
| get_user | GET /users/{user-id} | |
| get_users | GET /users |
PositionsResponse get_positions(opts)
This method allows you to get a list of all positions in your account.
# load the gem
require 'wheniwork-ruby'
# setup authorization
WhenIWork.configure do |config|
# Configure API key authorization: apiKey
config.api_key['W-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['W-Token'] = 'Bearer'
end
api_instance = WhenIWork::DefaultApi.new
opts = {
show_deleted: true # BOOLEAN | Whether to show positions that have been deleted.
}
begin
result = api_instance.get_positions(opts)
p result
rescue WhenIWork::ApiError => e
puts "Exception when calling DefaultApi->get_positions: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| show_deleted | BOOLEAN | Whether to show positions that have been deleted. | [optional] |
- Content-Type: application/json
- Accept: application/json
ShiftResponse get_shift(shift_id)
Gets the details of an existing shift.
# load the gem
require 'wheniwork-ruby'
# setup authorization
WhenIWork.configure do |config|
# Configure API key authorization: apiKey
config.api_key['W-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['W-Token'] = 'Bearer'
end
api_instance = WhenIWork::DefaultApi.new
shift_id = 56 # Integer | max records to return
begin
result = api_instance.get_shift(shift_id)
p result
rescue WhenIWork::ApiError => e
puts "Exception when calling DefaultApi->get_shift: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| shift_id | Integer | max records to return |
- Content-Type: application/json
- Accept: application/json
ShiftsResponse get_shifts(opts)
Get a list of shifts.
# load the gem
require 'wheniwork-ruby'
# setup authorization
WhenIWork.configure do |config|
# Configure API key authorization: apiKey
config.api_key['W-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['W-Token'] = 'Bearer'
end
api_instance = WhenIWork::DefaultApi.new
opts = {
user_id: "user_id_example", # String | The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3).
start: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | Start time for the search window. The default is the current date and time
_end: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | End time for the search window. The default is exactly three days from the start time.
location_id: "location_id_example", # String | The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas.
position_id: "position_id_example", # String | The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas.
include_open: true, # BOOLEAN | Whether to include OpenShifts in the results.
include_onlyopen: true, # BOOLEAN | Whether to include OpenShifts in the results.
unpublished: true # BOOLEAN | Whether unpublished shifts should be included in the results.
}
begin
result = api_instance.get_shifts(opts)
p result
rescue WhenIWork::ApiError => e
puts "Exception when calling DefaultApi->get_shifts: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | String | The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3). | [optional] |
| start | DateTime | Start time for the search window. The default is the current date and time | [optional] |
| _end | DateTime | End time for the search window. The default is exactly three days from the start time. | [optional] |
| location_id | String | The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas. | [optional] |
| position_id | String | The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas. | [optional] |
| include_open | BOOLEAN | Whether to include OpenShifts in the results. | [optional] |
| include_onlyopen | BOOLEAN | Whether to include OpenShifts in the results. | [optional] |
| unpublished | BOOLEAN | Whether unpublished shifts should be included in the results. | [optional] |
- Content-Type: application/json
- Accept: application/json
TimesResponse get_times(opts)
Get a list of times
# load the gem
require 'wheniwork-ruby'
# setup authorization
WhenIWork.configure do |config|
# Configure API key authorization: apiKey
config.api_key['W-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['W-Token'] = 'Bearer'
end
api_instance = WhenIWork::DefaultApi.new
opts = {
user_id: "user_id_example", # String | The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3).
start: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | Start time for the search window. The default is the current date and time
_end: DateTime.parse("2013-10-20T19:20:30+01:00") # DateTime | End time for the search window. The default is exactly three days from the start time.
}
begin
result = api_instance.get_times(opts)
p result
rescue WhenIWork::ApiError => e
puts "Exception when calling DefaultApi->get_times: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | String | The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3). | [optional] |
| start | DateTime | Start time for the search window. The default is the current date and time | [optional] |
| _end | DateTime | End time for the search window. The default is exactly three days from the start time. | [optional] |
- Content-Type: application/json
- Accept: application/json
UserResponse get_user(user_id)
Get a specific user by their ID.
# load the gem
require 'wheniwork-ruby'
# setup authorization
WhenIWork.configure do |config|
# Configure API key authorization: apiKey
config.api_key['W-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['W-Token'] = 'Bearer'
end
api_instance = WhenIWork::DefaultApi.new
user_id = 56 # Integer | The user identifier number
begin
result = api_instance.get_user(user_id)
p result
rescue WhenIWork::ApiError => e
puts "Exception when calling DefaultApi->get_user: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | Integer | The user identifier number |
- Content-Type: application/json
- Accept: application/json
UsersResponse get_users(opts)
Get a list of users.
# load the gem
require 'wheniwork-ruby'
# setup authorization
WhenIWork.configure do |config|
# Configure API key authorization: apiKey
config.api_key['W-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['W-Token'] = 'Bearer'
end
api_instance = WhenIWork::DefaultApi.new
opts = {
ids: "ids_example", # String | The IDs of the users to retrieve, as a comma-separated list (e.g. 9,17,42).
location_id: "location_id_example", # String | The ID of the location to get users for. For multiple locations, enter a list of location IDs separated by commas.
show_deleted: true # BOOLEAN | Whether to include deleted users in the results. Defaults to false.
}
begin
result = api_instance.get_users(opts)
p result
rescue WhenIWork::ApiError => e
puts "Exception when calling DefaultApi->get_users: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| ids | String | The IDs of the users to retrieve, as a comma-separated list (e.g. 9,17,42). | [optional] |
| location_id | String | The ID of the location to get users for. For multiple locations, enter a list of location IDs separated by commas. | [optional] |
| show_deleted | BOOLEAN | Whether to include deleted users in the results. Defaults to false. | [optional] |
- Content-Type: application/json
- Accept: application/json