Skip to content

Instantly share code, notes, and snippets.

@chrismanderson
Created September 27, 2016 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismanderson/942baf6c46ff585c52f48e6b2ed18cd4 to your computer and use it in GitHub Desktop.
Save chrismanderson/942baf6c46ff585c52f48e6b2ed18cd4 to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "v2",
"title": "Wheniwork"
},
"host": "api.wheniwork.com",
"basePath": "/2",
"schemes": [
"https"
],
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"securityDefinitions": {
"apiKey": {
"name": "W-Token",
"type": "apiKey",
"in": "header",
"description": "API Key"
}
},
"parameters": {
"user-id": {
"name": "user-id",
"in": "path",
"description": "The user identifier number",
"type": "integer",
"required": true
},
"shift-id": {
"name": "shift-id",
"in": "path",
"description": "max records to return",
"required": true,
"type": "integer"
}
},
"paths": {
"/times": {
"parameters": [
{
"name": "user_id",
"in": "query",
"description": "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).",
"type": "string"
},
{
"name": "start",
"in": "query",
"description": "Start time for the search window. The default is the current date and time",
"type": "string",
"format": "date-time"
},
{
"name": "end",
"in": "query",
"description": "End time for the search window. The default is exactly three days from the start time.",
"type": "string",
"format": "date-time"
}
],
"get": {
"security": [
{
"apiKey": []
}
],
"description": "Get a list of times",
"operationId": "get_times",
"responses": {
"200": {
"description": "A list of time objects",
"schema": {
"title": "times_response",
"type": "object",
"properties": {
"start": {
"type": "string",
"format": "date-time"
},
"end": {
"type": "string",
"format": "date-time"
},
"shifts": {
"type": "array",
"items": {
"$ref": "#/definitions/Shift"
}
},
"times": {
"type": "array",
"items": {
"$ref": "#/definitions/Time"
}
},
"positions": {
"type": "array",
"items": {
"$ref": "#/definitions/Position"
}
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
}
},
"/shifts": {
"parameters": [
{
"name": "user_id",
"in": "query",
"description": "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).",
"type": "string"
},
{
"name": "start",
"in": "query",
"description": "Start time for the search window. The default is the current date and time",
"type": "string",
"format": "date-time"
},
{
"name": "end",
"in": "query",
"description": "End time for the search window. The default is exactly three days from the start time.",
"type": "string",
"format": "date-time"
},
{
"name": "location_id",
"in": "query",
"description": "The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas.",
"type": "string"
},
{
"name": "position_id",
"in": "query",
"description": "The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas.",
"type": "string"
},
{
"name": "include_open",
"in": "query",
"description": "Whether to include OpenShifts in the results.",
"type": "boolean"
},
{
"name": "include_onlyopen",
"in": "query",
"description": "Whether to include OpenShifts in the results.",
"type": "boolean"
},
{
"name": "unpublished",
"in": "query",
"description": "Whether unpublished shifts should be included in the results.",
"type": "boolean"
}
],
"get": {
"security": [
{
"apiKey": []
}
],
"description": "Get a list of shifts.",
"operationId": "get_shifts",
"responses": {
"200": {
"description": "A list of shift objects",
"schema": {
"title": "shifts_response",
"type": "object",
"properties": {
"start": {
"type": "string",
"format": "date-time"
},
"end": {
"type": "string",
"format": "date-time"
},
"shifts": {
"type": "array",
"items": {
"$ref": "#/definitions/Shift"
}
}
}
}
}
}
}
},
"/shifts/{shift-id}": {
"parameters": [
{
"$ref": "#/parameters/shift-id"
}
],
"get": {
"security": [
{
"apiKey": []
}
],
"operationId": "get_shift",
"description": "Gets the details of an existing shift.",
"responses": {
"200": {
"description": "The shift object",
"schema": {
"title": "shift_response",
"type": "object",
"properties": {
"shift": {
"$ref": "#/definitions/Shift"
}
}
}
}
}
}
},
"/users": {
"parameters": [
{
"name": "ids",
"in": "query",
"description": "The IDs of the users to retrieve, as a comma-separated list (e.g. 9,17,42).",
"type": "string"
},
{
"name": "location_id",
"in": "query",
"description": "The ID of the location to get users for. For multiple locations, enter a list of location IDs separated by commas.",
"type": "string"
},
{
"name": "show_deleted",
"in": "query",
"description": "Whether to include deleted users in the results. Defaults to false.",
"type": "boolean"
}
],
"get": {
"security": [
{
"apiKey": []
}
],
"description": "Get a list of users.",
"operationId": "get_users",
"responses": {
"200": {
"description": "A list of user objects",
"schema": {
"title": "users_response",
"type": "object",
"properties": {
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
}
},
"/users/{user-id}": {
"parameters": [
{
"$ref": "#/parameters/user-id"
}
],
"get": {
"security": [
{
"apiKey": []
}
],
"operationId": "get_user",
"description": "Get a specific user by their ID.",
"responses": {
"200": {
"description": "The user object",
"schema": {
"title": "user_response",
"type": "object",
"properties": {
"user": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
},
"/positions": {
"parameters": [
{
"name": "show_deleted",
"in": "query",
"description": "Whether to show positions that have been deleted.",
"type": "boolean"
}
],
"get": {
"security": [
{
"apiKey": []
}
],
"operationId": "get_positions",
"description": "This method allows you to get a list of all positions in your account.",
"responses": {
"200": {
"description": "A list of position objects",
"schema": {
"title": "positions_response",
"type": "object",
"properties": {
"positions": {
"type": "array",
"items": {
"$ref": "#/definitions/Position"
}
}
}
}
}
}
}
}
},
"definitions": {
"Shift": {
"type": "object",
"properties": {
"start_time": {
"type": "string",
"format": "date-time"
},
"end_time": {
"type": "string",
"format": "date-time"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"notified_at": {
"type": "string",
"format": "date-time"
},
"id": {
"type": "integer"
},
"account_id": {
"type": "integer"
},
"user_id": {
"type": "integer"
},
"location_id": {
"type": "integer"
},
"alerted": {
"type": "boolean"
},
"is_open": {
"type": "boolean"
},
"acknowledged": {
"type": "integer"
},
"notes": {
"type": "string"
}
}
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"account_id": {
"type": "integer"
},
"role": {
"type": "integer"
},
"email": {
"type": "string"
},
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"phone_number": {
"type": "string"
},
"employee_code": {
"type": "string"
},
"positions": {
"type": "array",
"items": {
"type": "integer"
}
},
"locations": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"Time": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"account_id": {
"type": "integer"
},
"user_id": {
"type": "integer"
},
"creator_id": {
"type": "integer"
},
"position_id": {
"type": "integer"
},
"location_id": {
"type": "integer"
},
"site_id": {
"type": "integer"
},
"shift_id": {
"type": "integer"
},
"start_time": {
"type": "string",
"format": "date-time"
},
"end_time": {
"type": "string",
"format": "date-time"
},
"length": {
"type": "number",
"format": "float"
},
"hourly_rate": {
"type": "number",
"format": "float"
},
"is_alerted": {
"type": "boolean"
},
"alert_type": {
"type": "integer"
},
"is_approved": {
"type": "boolean"
},
"modified_by": {
"type": "integer"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
},
"Position": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"color": {
"type": "string"
},
"sort": {
"type": "integer"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment