Introduction
Welcome to the FIT-Outcomes API
Hello FIT-Outcomes:
import requests
import json
url = "https://api.fit-outcomes.com/"
r = requests.get(url)
pprint(r.json())
JSON response:
{
"hello-from": "The FIT-Outcomes API",
"api-reference": "https://docs.api.fit-outcomes.com/"
}
You can use this API to programmatically access your client data and statistics from www.fit-outcomes.com.
You can view code examples in the dark area to the right. The examples are written in Python 3 since this is an easy language to read and write, but you can use whatever language you prefer.
Please note that you are only allowed to use this API to access your own agency data. You cannot use this API if you are a third-party application provider (e.g. you are developing and selling integration solutions).
When you have read this introduction, you should proceed to Authentication. Getting authentication right is crucial for using the API.
The API endpoint is located here: https://api.fit-outcomes.com
RESTful (-ish)
RESTful (-ish) example:
import requests
import json
# Notice the "get" verb at the end of the URL
url = "https://api.fit-outcomes.com/v1/clients/123/get"
# Authentication headers
headers = {
"X-Api-Email": my_email,
"X-Api-Token": my_token
}
# Include session data when getting the client data
parameters = {
"include": ["sessions"]
}
# Notice we're using requests.post instead of requests.get
requests.post(url, headers=headers, data=json.dumps(parameters))
We have wandered a bit off the beaten path when it comes to implementing a RESTful API.
One of the usual requirements of a RESTful HTTP API is that the server must utilize the HTTP verbs GET, POST, PATCH, DELETE, etc., to get or manipulate the various resources (e.g. clients, users, etc.). One of the drawbacks of this approach is that the GET verb does not support sending body-data, but must supply all parameters directly in the URL instead. This means no easy way to send JSON through a GET request. That is no fun when using an API.
Instead we use POST for almost everything and put the verb in the end of the URL. Observe:
Standard REST | api.fit-outcomes.com REST | |
---|---|---|
Get all clients | GET /v1/clients/ | POST /v1/clients/get |
Get client with ID 123 | GET /v1/clients/123 | POST /v1/clients/123/get |
Create new client | POST /v1/clients/ | POST /v1/clients/create |
Update client 123 | PUT /v1/clients/123 | POST /v1/clients/123/update |
Patch client 123 | PATCH /v1/clients/123 | POST /v1/clients/123/update |
Delete client 123 | DELETE /v1/clients/123 | POST /v1/clients/123/delete |
Any parameters beyond the ID go into POST body as normal JSON.
Request and Response
Data from successful requests is contained in a JSON object in the key "data":
{
"data": {
"foo": "bar"
}
}
Details about a failed 4xx request are contained in a JSON object in the key "error":
{
"error": {
"message": "Access denied"
}
}
Details about a failed 5xx request are contained in a JSON object in the key "error":
{
"error": {
"message": "Internal server error. Support staff has been notified."
}
}
Whenever you do a request, the API will either respond with success (HTTP status code 200) or failure (HTTP status codes 4xx or 500).
If you get a 200, all is good and you might even have gotten some data back from the server. Data from server is always in the form of a JSON object with a "data" key containing the resource specific data.
If you get a 4xx (e.g. 400 or 403), it means you probably made a mistake. The resulting JSON object will tell the reason on the error.message key.
If you get a 500, it means something is not right on the server. The resulting JSON object won't tell you anything useful.
More about errors here.
JSON Request Payloads
# Include episode data when getting the client data
payload = {
"include": ["episodes"]
}
requests.post(url, headers=headers, data=json.dumps(payload))
Some URLs accept JSON payloads. For example, when you request data on a specific client, you can ask the server to also return all the episodes for that client. This is done by sending a JSON object along with the request, indicating what data should be "included".
Authentication
Email and Token
Set up authentication headers:
import requests
url = "https://api.fit-outcomes.com/v1/users/me/get"
headers = {
"X-Api-Email": my_email,
"X-Api-Token": my_token
}
requests.post(url, headers=headers)
We would like to know a bit about your plans with the API, so please send us an email with a few details and then we will enable it for you. Note that your initial access will only allow you to read data, not change or delete. Once you have gotten your feet wet with the API, you may request write access as well.
Access to your data requires authenticaion. Valid authentication is obtained by sending the following headers in every HTTP request:
Header | Description |
---|---|
X-Api-Email | The email address you use to log on to www.fit-outcomes.com |
X-Api-Token | The API token associated with your user (see below on how to get it) |
If you request a resource that requires authentication (most do) and X-Api-Email and/or X-Api-Token are missing or incorrect, the API will reject your request with HTTP status code 401 and the resulting JSON error object will say "Authentication failed".
Otherwise your request will complete with HTTP status code 200 and the resulting JSON object will contain the relevant data.
Getting the Token
import requests
import json
my_email = "john@example.com"
my_password = "secretsauce"
url = "https://api.fit-outcomes.com/v1/authenticate/get"
payload = {
"email": my_email,
"password": my_password,
}
r = requests.post(url, data=json.dumps(payload))
# Provided everyhing went well, r.json() now contains the token
my_token = r.json()["data"]["apiToken"]
url = "https://api.fit-outcomes.com/v1/users/me/get"
# Construct the authentication header with our newly obtained token
headers = {
"X-Api-Email": my_email,
"X-Api-Token": my_token
}
r = requests.post(url, headers=headers)
That last request will result in JSON like this:
{
"data": {
"users": [{
"agency_id": 1,
"email": "john@example.com",
"full_name": "John Doe",
"id": 123,
"locale": "da",
"role_list": [],
"screen_lock_after_score": true,
"screen_lock_code": "1111",
"screen_lock_timeout": null,
"time_zone": ""
}]
}
}
Getting the above mentioned API Token requires that you authenticate with the email and password you normally use on www.fit-outcomes.com.
URL
https://api.fit-outcomes.com/v1/authenticate/get
JSON request payload
Key | Value | Description |
---|---|---|
your-email-address | The email address used to log in to www.fit-outcomes.com. | |
password | your-password | The password used to log in to www.fit-outcomes.com. |
Response 200, JSON data
Key | Value | Description |
---|---|---|
data.apiToken | your-api-token | The API token you must use for all other requests |
Response 401
If you get a HTTP status code 401 back, it means you have provided an incorrect combination of email and password.
Agencies
The agency groups users and clients into an organizational unit.
My Agency
Fetch the agency the current user belongs to. Only superusers can do this.
URL
https://api.fit-outcomes.com/v1/agencies/mine/get
Example getting agency and including users and episodes:
# Include all users, clients and the clients' episodes
payload = {
"include": ["users","episodes"]
}
url = "https://api.fit-outcomes.com/v1/agencies/mine/get"
requests.post(url, headers=headers, data=json.dumps(payload))
JSON request payload:
include
Array of strings listing the entities to include when fetching the data.
Entity | What is included |
---|---|
users | All users in the agency |
clients | All clients in the agency |
episodes | Clients and their treatment episodes |
raters | Clients, their treatment episodes and their raters on the episodes |
sessions | Clients, their treatment episodes, their raters on the episodes and the sessions on the episodes |
scores | Clients, their treatment episodes, their raters on the episodes, the sessions on the episodes and the scores in the sessions |
Response 200, JSON data
Key | Value |
---|---|
data.agencies | array of agencies |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Users
Get all users in agency
Fetch all users in the agency the current user belongs to. Only superusers can do this.
Get all users in agency:
url = "https://api.fit-outcomes.com/v1/users/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/users/get
JSON request payload:
Get all users in agency with the string "Doe" in their email or name:
url = "https://api.fit-outcomes.com/v1/users/get"
parameters = {
"search_term": "Doe"
}
requests.post(url, headers=headers, data=json.dumps(parameters))
search_term
String for filtering the users. Users' email and name are used when searching.
Get all users in agency with the string "Doe" in email or name. Include clients.
url = "https://api.fit-outcomes.com/v1/users/get"
parameters = {
"search_term": "Doe",
"include": ["clients"]
}
requests.post(url, headers=headers, data=json.dumps(parameters))
include
Array of strings listing the entities to include when fetching the data.
Entity | What is included |
---|---|
agency | The agency the user belongs to (superusers only) |
clients | The clients belonging to the user |
episodes | The clients and their episodes |
raters | The clients, their episodes and collateral raters |
sessions | The clients, their episodes, raters and sessions |
scores | The clients, their episodes, raters, sessions and scores |
Distributing the load per-user:
# First get all the users
url = "https://api.fit-outcomes.com/v1/users/get"
r = requests.post(url, headers=headers)
users = r.json()["data"]["users"]
# Then for each user we got, reload it and this time include the scores
# (which also will bring episodes, raters, sessions)
for user in users:
url = "https://api.fit-outcomes.com/v1/users/{:d}/get".format(user["id"])
parameters = {
"include": ["scores"]
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Response 200, JSON data
Key | Value |
---|---|
data.users | Array of users |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get current user
Fetch your user data (i.e. the data for the currently authenticated user).
Get my user data:
url = "https://api.fit-outcomes.com/v1/users/me/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/users/me/get
JSON request payload:
include
As above
Response 200, JSON data
Key | Value |
---|---|
data.users | Array of users |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get user
Fetch a specific user by database id.
Get user with database id 123:
url = "https://api.fit-outcomes.com/v1/users/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/users/<id>/get
Query parameters:
id
Database id of the user to get.
JSON request payload:
include
As above
Response 200, JSON data
Key | Value |
---|---|
data.users | Array of users |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create user
Create a new user and assign it to the current agency. Only superusers can do this.
Create a new user:
url = "https://api.fit-outcomes.com/v1/users/create"
parameters = {
"user": {
"email": "john@example.com",
"full_name": "John Doe",
"password": "johns fairly secure p@ssword!"
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/users/create
JSON request payload:
user
Field | Description |
---|---|
User's email address (string, required) | |
full_name | User's full name (string, required) |
password | User's password (string, required) |
gdpr_approval | If user has given his or hers GDPR approval (boolean, optional, default false). |
Response 200, JSON data
Key | Value |
---|---|
data.users | Array of one with the newly created user |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Update user
Update the specified user. Users can update their own data. Supersusers can update other users as well.
Update user with database id 123:
url = "https://api.fit-outcomes.com/v1/users/123/update"
parameters = {
"user": {
"password": "johns new and even more secure p@ssword!"
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/users/<id>/update
Query parameters:
id
Database id of the user to update.
JSON request payload:
user
As above
Response 200, JSON data
Key | Value |
---|---|
data.users | Array of one with the updated user |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete user
Delete a user. By default it is only possible to delete users that have no clients. You can override this default by putting a force flag in the JSON payload. When force deleting, all clients (and all their dependees) are also deleted unless they belong to other users as well.
Delete a user with database id 123 that has no clients:
url = "https://api.fit-outcomes.com/v1/users/123/delete"
r = requests.post(url, headers=headers)
Force delete a user with database id 123 that has clients:
url = "https://api.fit-outcomes.com/v1/users/123/delete"
parameters = {
"force": True
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/users/<id>/delete
Query parameters:
id
Database id of the user to delete.
JSON request payload:
force
if set to true (boolean), the user and all clients owned exclusive by the user are deleted.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Add role
Add a role to the specified user. The following roles are available:
Role | Description |
---|---|
agency_admin | The superuser role. Only superusers can assign this role. |
auditing | This role is currently not used |
disabled | The used is disabled and can not authenticate nor log in |
Normal users have no roles assigned to them.
Add role "disabled" to user with database id 123
url = "https://api.fit-outcomes.com/v1/users/123/role/create"
parameters = {
"role": "disabled"
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/users/<id>/role/create
Query parameters:
id
Database id of the user to assign role to.
JSON request payload:
role
Role name (string) to assign to the user.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Remove role
Remove a role from the specified user.
Remove role "disabled" from user with database id 123
url = "https://api.fit-outcomes.com/v1/users/123/role/delete"
parameters = {
"role": "disabled"
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/users/<id>/role/delete
Query parameters:
id
Database id of the user to remove role from.
JSON request payload:
role
Role name (string) to remove from the user.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Clients
Get all clients in agency
Fetch all clients in the agency the current user belongs to. Only superusers can do this.
Get all clients in agency:
url = "https://api.fit-outcomes.com/v1/clients/agency/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/clients/agency/get
JSON request payload:
Get all clients in agency with the string "Doe" in their name, alias or id/ssn:
url = "https://api.fit-outcomes.com/v1/clients/agency/get"
parameters = {
"search_term": "Doe"
}
requests.post(url, headers=headers, data=json.dumps(parameters))
search_term
String for filtering the clients. Client's name, alias and id/ssn are used when searching (case insensitive).
labels
Array of strings listing one or more labels of which the clients must have at least one of. Be sure to enter the exact label names.
Get all clients in agency with the string "Doe" in their name, alias or id/ssn AND at least one of the labels "Foo" and "Bar":
url = "https://api.fit-outcomes.com/v1/clients/agency/get"
parameters = {
"search_term": "Doe",
"labels": ["Foo", "Bar"],
}
requests.post(url, headers=headers, data=json.dumps(parameters))
Get all clients in agency with the string "Doe" in their name, alias or id/ssn. Include users, episodes, sessions and scores.
url = "https://api.fit-outcomes.com/v1/clients/agency/get"
parameters = {
"search_term": "Doe",
"include": ["users", "scores"]
}
requests.post(url, headers=headers, data=json.dumps(parameters))
include
Array of strings listing the entities to include when fetching the data.
Entity | What is included |
---|---|
agency | The agency the clients belong to (superusers only) |
users | The users the clients belong to (for security reasons only id, email and full_name are fetched) |
labels | The labels on the client |
episodes | The episodes the clients are on |
raters | The episodes the clients are on and their raters on the episodes |
sessions | The episodes the clients are on, their raters on the episodes and the sessions on the episodes |
scores | The episodes the clients are on, their raters on the episodes, the sessions on the episodes and the scores in the sessions |
Distributing the load per-user:
# First get all the users
url = "https://api.fit-outcomes.com/v1/users/get"
r = requests.post(url, headers=headers)
users = r.json()["data"]["users"]
# Then for each user we got, reload it and this time include the scores
# (which also will bring episodes, raters, sessions)
for user in users:
url = "https://api.fit-outcomes.com/v1/users/{:d}/get".format(user["id"])
parameters = {
"include": ["scores"]
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of clients |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get all user's clients
Fetch all clients belonging to current or to specific user.
Get all clients belonging to current user:
url = "https://api.fit-outcomes.com/v1/clients/get"
requests.post(url, headers=headers)
Get all clients belonging to user with database id 123:
url = "https://api.fit-outcomes.com/v1/clients/get"
parameters = {
"user_id": 123,
}
requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/get
JSON request payload:
user_id
ID (integer) of the user to fetch clients for.
search_term
As above
labels
As above
include
As above
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of clients |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get client
Fetch a specific client by database id.
Get client with database id 123:
url = "https://api.fit-outcomes.com/v1/clients/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/clients/<id>/get
Query parameters:
id
Database id of the client to get.
JSON request payload:
include
As above
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of clients |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create client
Create a new client and assign it to the current user.
Create a new client:
url = "https://api.fit-outcomes.com/v1/clients/create"
parameters = {
"client": {
"full_name": "John Doe",
"birth_date": "2010-10-19"
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/create
JSON request payload:
client
Field | Description |
---|---|
full_name | Full name of the client (string, required) |
alias | Client alias (string, optional). You can use this field to store altenative lookup strings, names, etc. |
ssn | Client ssn (string, optional). You can use this field to store altenative lookup strings, names, etc. |
birth_date | Client birth date (string ISO 8601, optional). |
gender | Client gender (integer 0=unknown, 1=male, 2=female, 3=transgender, optional) |
phone | Client phone (string, optional). |
comment | Comments (string, optional). |
gdpr_approval | If client has given his or hers GDPR approval (boolean, optional, default false). |
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of one with the newly created client |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Update client
Update an existing client.
Update client with database id 123:
url = "https://api.fit-outcomes.com/v1/clients/123/update"
parameters = {
"client": {
"full_name": "Jane Doe",
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/<id>/update
Query parameters:
id
Database id of the client to update.
JSON request payload:
client
As above
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of one with the updated client |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete client
Delete a client. By default it is only possible to delete clients that have no episodes, sessions and scores. You can override this default and delete the client and every dependee it has by putting a force flag in the JSON payload. This means that all the client's scores are deleted. All the client's session entries are delete. And finally, all the client's episode entries are deleted. If there are no more clients left on an episode, the episode itself is also deleted.
Delete a client with database id 123 that has no episodes, sessions or scores:
url = "https://api.fit-outcomes.com/v1/clients/123/delete"
r = requests.post(url, headers=headers)
Force delete a client with database id 123 that has episodes, sessions and scores:
url = "https://api.fit-outcomes.com/v1/clients/123/delete"
parameters = {
"force": True
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/<id>/delete
Query parameters:
id
Database id of the client to delete.
JSON request payload:
force
if set to true (boolean), the client and all its dependees are deleted.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get client owners
Get the ids, emails and names of the users "owning" the client.
Get the owners of client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/users/get"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/clients/<id>/users/get
Query parameters:
id
Database id of the client.
Response 200, JSON data
Key | Value |
---|---|
users | Array of ids, emails and names |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Set client owners
Set the owners (i.e. users) of the client. A client must have at least one owner. Note that any previous owners will be removed.
Set the owners of client 123 to users with ids 100 and 102:
url = "https://api.fit-outcomes.com/v1/clients/123/users/update"
parameters = {
"users": [100, 102]
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/<id>/users/update
Query parameters:
id
Database id of the client.
JSON request payload:
users
Array of user-ids
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get client labels
Get the labels attached to the client.
Get the labels attached to client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/labels/get"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/clients/<id>/labels/get
Query parameters:
id
Database id of the client.
Response 200, JSON data
Key | Value |
---|---|
labels | Array of labels |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Set client labels
Attached labels to the client. Note that any previous labels will be removed.
Attach labels with id 100 and 102 to client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/labels/update"
parameters = {
"labels": [100, 102]
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/<id>/labels/update
Query parameters:
id
Database id of the client.
JSON request payload:
labels
Array of label-ids
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get client's episodes
Get the client's treatment episodes.
Get all episodes for client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/episodes/get"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/clients/<id>/episodes/get
Query parameters:
id
Database id of the client.
Response 200, JSON data
Key | Value |
---|---|
data.episodes | array of episodes |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create treatment episode
Create a new treatment episode for the client.
Create a new episode for client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/episodes/create"
parameters = {
"episode": {
"title": "Couples therapy",
"start_date": "2017-10-29"
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/<id>/episodes/create
Query parameters:
id
Database id of the client.
JSON request payload:
episode
Field | Description |
---|---|
title | Episode title (string, required) |
start_date | Start date (string ISO 8601, required). |
end_date | End date (string ISO 8601, optional). |
status | Status (integer 0=Ongoing, 1=Terminated-no-effect, 2=Terminated-with-effect, 3=Terminated-mutual-agreement, optional, default 0) |
comment | Comments (string, optional). |
group_srs | True if this episode is group sessions (boolean, optional, default false). |
Response 200, JSON data
Key | Value |
---|---|
data.episodes | Array of one with the newly created episode |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Client charting scores
Get all scores for the client in a charting friendly structure. You can either get scores for a specific episode or for all episodes. Also includes ORS trajectory if one or more ORS scores exists.
Get all scores for client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/scoresbysession/get"
r = requests.post(url, headers=headers)
Get all scores on episode 456 for client 123:
url = "https://api.fit-outcomes.com/v1/clients/123/scoresbysession/get"
parameters = {
"episode_id": 456
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/clients/<id>/scoresbysession/get
Query parameters:
id
Database id of the client.
JSON request payload:
episode_id
Optional id of the episode to get scores from
Response 200, JSON data
Key | Value |
---|---|
data.scores | Array of episodes with sessions and scores by date |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Labels
Get all labels in agency
Fetch all labels in the agency the current user belongs to. Only superusers can do this.
Get all labels in agency:
url = "https://api.fit-outcomes.com/v1/labels/agency/get
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/labels/agency/get
Response 200, JSON data
Key | Value |
---|---|
data.labels | Array of labels |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get label
Fetch a specific label by database id.
Get label with database id 123:
url = "https://api.fit-outcomes.com/v1/labels/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/labels/<id>/get
Query parameters:
id
Database id of the label to get.
Response 200, JSON data
Key | Value |
---|---|
data.labels | Array of one of labels |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create label
Create a new label and assign it to the current agency. Only superusers can do this.
Create a new label:
url = "https://api.fit-outcomes.com/v1/label/create"
parameters = {
"label": {
"name": "my label",
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/labels/create
JSON request payload:
label
Field | Description |
---|---|
name | Name of the label (string, required) |
Response 200, JSON data
Key | Value |
---|---|
data.labels | Array of one with the newly created label |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Update label
Update the specified label. Only superusers can do this.
Update label with database id 123:
url = "https://api.fit-outcomes.com/v1/labels/123/update"
parameters = {
"label": {
"name": "new label name"
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/labels/<id>/update
Query parameters:
id
Database id of the label to update.
JSON request payload:
label
As above
Response 200, JSON data
Key | Value |
---|---|
data.labels | Array of one with the updated label |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete label
Delete a label. By default it is only possible to delete labels that are not used by any clients. You can override this default by putting a force flag in the JSON payload.
Delete a label with database id 123 that isn't used by any clients:
url = "https://api.fit-outcomes.com/v1/labels/123/delete"
r = requests.post(url, headers=headers)
Force delete a label with database id 123 that is in use by one or more clients:
url = "https://api.fit-outcomes.com/v1/labels/123/delete"
parameters = {
"force": True
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/labels/<id>/delete
Query parameters:
id
Database id of the label to delete.
JSON request payload:
force
if set to true (boolean), the label is deleted even if it is in use.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Treatment Episodes
Get all episodes in agency
Fetch all episodes in the agency the current user belongs to. Only superusers can do this.
Get all episodes in agency:
url = "https://api.fit-outcomes.com/v1/episodes/agency/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/agency/get
JSON request payload:
Get all episodes in agency with title containing "foo".
url = "https://api.fit-outcomes.com/v1/episodes/agency/get"
parameters = {
"search_term": "foo"
}
requests.post(url, headers=headers, data=json.dumps(parameters))
Get all episodes in agency with the string "foo" in their titles AND at least one of the labels "bar" and "baz":
url = "https://api.fit-outcomes.com/v1/episodes/agency/get"
parameters = {
"search_term": "foo",
"labels": ["bar", "baz"],
}
requests.post(url, headers=headers, data=json.dumps(parameters))
Get all episodes in agency. Include collateral raters and sessions.
url = "https://api.fit-outcomes.com/v1/episodes/agency/get"
parameters = {
"include": ["raters", "sessions"]
}
requests.post(url, headers=headers, data=json.dumps(parameters))
search_term
String for filtering the episodes. The episodes' titles are used for searching (case insensitive).
labels
Array of strings listing one or more labels of which the episodes must have at least one of. Be sure to enter the exact label names.
include
Array of strings listing the entities to include when fetching the data.
Entity | What is included |
---|---|
agency | The agency the episode belong to (superusers only) |
clients | The clients on the episode |
raters | The collateral raters on the episode |
sessions | The sessions on the episode |
scores | The sessions and scores on the episode |
Response 200, JSON data
Key | Value |
---|---|
data.episodes | Array of episodes |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get all user's episodes
Fetch all episodes belonging to current or specific user.
Get all episodes belonging to current user:
url = "https://api.fit-outcomes.com/v1/episodes/get"
requests.post(url, headers=headers)
Get all episodes belonging to user with database id 123:
parameters = {
"user_id": 123
}
url = "https://api.fit-outcomes.com/v1/episodes/get"
requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/episodes/get
JSON request payload:
user_id
ID (integer) of the user to fetch episodes for.
search_term
As above
labels
As above
include
As above
Response 200, JSON data
Key | Value |
---|---|
data.episodes | Array of episodes |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get episode
Fetch a specific episode by database id.
Get episode with database id 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/<id>/get
Query parameters:
id
Database id of the episode to get.
JSON request payload:
include
As above
Response 200, JSON data
Key | Value |
---|---|
data.episodes | Array of episodes |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create episode
Creating new treatment episodes is done on the client
Update episode
Update an existing treatment episode.
Update episode with database id 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/update"
parameters = {
"episode": {
"title": "A new title for the episode",
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/episodes/<id>/update
Query parameters:
id
Database id of the client to update.
JSON request payload:
episode
As above
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of one with the updated episode |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete episode
Delete an episode. By default it is only possible to delete episodes that have no clients, raters, sessions and scores. You can override this default and delete the episode and every dependee it has by putting a force flag in the JSON payload. This means that all the episode's raters, sessions and scores are deleted.
Delete a episode with database id 123 that has no episodes, sessions or scores:
url = "https://api.fit-outcomes.com/v1/episodes/123/delete"
r = requests.post(url, headers=headers)
Force delete a episode with database id 123 that has episodes, sessions and scores:
url = "https://api.fit-outcomes.com/v1/episodes/123/delete"
parameters = {
"force": True
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/episodes/<id>/delete
Query parameters:
id
Database id of the episode to delete.
JSON request payload:
force
if set to true (boolean), the episode and all its dependees are deleted.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get clients on episode
Get the clients on the treatment episode.
Get clients on episode with database id 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/clients/get"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/<id>/clients/get
Query parameters:
id
Database id of the episode to get clients from.
Response 200, JSON data
Key | Value |
---|---|
data.clients | Array of clients |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Add client to episode
Add a client to the treatment episode.
Add client 456 to episode 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/clients/456/create"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/<episode-id>/clients/<client-id>/create
Query parameters:
episode-id
Database id of the episode to add the client to.
client-id
Database id of the client to add to the episode.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Remove client from episode
Remove a client from the treatment episode. If the client has scores on the episode, you must use the force=true flag to force the removal of the client and the deletion of all collateral raters and scores belonging to the client. If the last client is removed, the episode is deleted.
Remove client 456 from episode 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/clients/456/delete"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/<episode-id>/clients/<client-id>/delete
Query parameters:
episode-id
Database id of the episode to remove the client from.
client-id
Database id of the client to remove from the episode.
force
if set to true (boolean), the client is removed and all its collateral raters and scores deleted.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get raters on episode
Get the collateral raters on the treatment episode.
Get raters on episode with database id 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/raters/get"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/<id>/raters/get
Query parameters:
id
Database id of the episode to get raters from.
Response 200, JSON data
Key | Value |
---|---|
data.raters | Array of raters |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create rater on episode
Create a collateral rater for a client on a treatment episode.
Create rater for client 456 on episode 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/clients/456/raters/create"
parameters = {
"rater": {
"full_name": "John's mother"
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/episodes/<episode-id>/clients/<client-id>/raters/create
Query parameters:
episode-id
Database id of the episode to add the rater to.
client-id
Database id of the client to add the rater to.
JSON request payload:
rater
Field | Description |
---|---|
full_name | Full name of the collateral rater (string, required) |
Email address of the rater (string, optional) | |
comment | Comments (string, optional). |
Response 200, JSON data
Key | Value |
---|---|
data.raters | Array of one of the newly created collateral rater |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get sessions on episode
Get sessions on the treatment episode.
Get sessions on episode with database id 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/sessions/get"
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/episodes/<id>/sessions/get
Query parameters:
id
Database id of the episode to get sessions from.
Response 200, JSON data
Key | Value |
---|---|
data.sessions | Array of sessions |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create session on episode
Create a session on a treatment episode.
Create new session on episode 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/sessions/create"
parameters = {
"session": {
"session_date": "2018-11-29"
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/episodes/<episode-id>/sessions/create
Query parameters:
id
Database id of the episode to add the session to.
JSON request payload:
session
Field | Description |
---|---|
session_date | Session date (string ISO 8601, required). |
Response 200, JSON data
Key | Value |
---|---|
data.sessions | Array of one of the newly created session |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Episode charting scores
Get all scores on episode in a charting-friendly format. You can either get scores for a specific client or for all clients. Also includes ORS trajectory if one or more ORS scores exists.
Get all scores for episode 123:
url = "https://api.fit-outcomes.com/v1/episodes/123/scoresbysession/get"
r = requests.post(url, headers=headers)
Get all scores on episode 123 for client 456:
url = "https://api.fit-outcomes.com/v1/episodes/123/scoresbysession/get"
parameters = {
"client_id": 456
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/episodes/<id>/scoresbysession/get
Query parameters:
id
Database id of the episode.
JSON request payload:
client_id
Optional id of the client to get scores for
Response 200, JSON data
Key | Value |
---|---|
data.scores | Array of episodes and clients with sessions and scores by date |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Collateral Raters
Get rater
Fetch a specific collateral rater by database id.
Get rater with database id 123:
url = "https://api.fit-outcomes.com/v1/raters/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/raters/<id>/get
Query parameters:
id
Database id of the collateral rater to get.
Response 200, JSON data
Key | Value |
---|---|
data.raters | Array of one with the specified rater |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Update rater
Update the specified rater.
Update rater with database id 123:
url = "https://api.fit-outcomes.com/v1/raters/123/update"
parameters = {
"rater": {
"full_name": "John's father"
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/raters/<id>/update
Query parameters:
id
Database id of the rater to update.
JSON request payload:
rater
As above
Response 200, JSON data
Key | Value |
---|---|
data.raters | Array of one with the updated rater |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete rater
Delete a collateral rater. By default it is only possible to delete raters that have no scores. You can override this default by putting a force flag in the JSON payload. When force deleting, all the rater's scores are also deleted.
Delete a rater with database id 123 that has no scores:
url = "https://api.fit-outcomes.com/v1/raters/123/delete"
r = requests.post(url, headers=headers)
Force delete a rater with database id 123 that has scores:
url = "https://api.fit-outcomes.com/v1/raters/123/delete"
parameters = {
"force": True
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/raters/<id>/delete
Query parameters:
id
Database id of the rater to delete.
JSON request payload:
force
if set to true (boolean), the rater and all its scores are deleted.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Sessions
Get session
Fetch a specific session by database id.
Get session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/get"
requests.post(url, headers=headers)
Get session with database id 123 and include scores:
url = "https://api.fit-outcomes.com/v1/sessions/123/get"
parameters = {
"include": ["scores"]
}
requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<id>/get
Query parameters:
id
Database id of the session to get.
JSON request payload:
include
Array of strings listing the entities to include when fetching the data.
Entity | What is included |
---|---|
episode | The episode the session belongs to |
scores | The scores on the session |
Response 200, JSON data
Key | Value |
---|---|
data.sessions | Array of one of sessions |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create session
Sessions are created on the episode
Update session
Update an existing session.
Update session with database id 123 with a new session date:
url = "https://api.fit-outcomes.com/v1/sessions/123/update"
parameters = {
"session": {
"session_date": "2017-02-23",
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<id>/update
Query parameters:
id
Database id of the session to update.
JSON request payload:
session
As above
Response 200, JSON data
Key | Value |
---|---|
data.sessions | Array of one with the updated session |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete session
Delete a session. By default it is only possible to delete sessions that have no scores on then. You can override this default by putting a force flag in the JSON payload. This will have the effect of deleting all the scores on the session as well.
Delete a session with database id 123 that has no scores:
url = "https://api.fit-outcomes.com/v1/sessions/123/delete"
r = requests.post(url, headers=headers)
Force delete a session with database id 123 that has scores:
url = "https://api.fit-outcomes.com/v1/sessions/123/delete"
parameters = {
"force": True
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<id>/delete
Query parameters:
id
Database id of the session to delete.
JSON request payload:
force
if set to true (boolean), the session and all its scores are deleted.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get ORS scores
Get ORS scores on the session
Get ORS scores from session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/ors_scores/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/sessions/<id>/ors_scores/get
Query parameters:
id
Database id of the session to get ORS scores from.
Response 200, JSON data
Key | Value |
---|---|
data.ors_scores | Array of ORS scores |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create client ORS
Create a client ORS score on a session.
Create ORS score for client with database id 456 on session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/ors_score/client/456/create"
parameters = {
"ors_score": {
"individually": 4.6,
"interpersonally": 7.1,
"socially": 4.7,
"overall": 5.1,
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<session_id>/ors_scores/client/<client_id>/create
Query parameters:
session_id
Database id of the session on which to create the new score.
client_id
Database id of the client on which to create the new score.
JSON request payload:
ors_score
Field | Description |
---|---|
individually | Number between 0 and 10 (required) |
interpersonally | Number between 0 and 10 (required) |
socially | Number between 0 and 10 (required) |
overall | Number between 0 and 10 (required) |
Response 200, JSON data
Key | Value |
---|---|
data.ors_scores | Array of one of the newly created ORS score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create rater ORS
Create a collateral rater ORS score on a session.
Create ORS score for rater with database id 456 on session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/ors_score/rater/456/create"
parameters = {
"ors_score": {
"individually": 4.6,
"interpersonally": 7.1,
"socially": 4.7,
"overall": 5.1,
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<session_id>/ors_scores/rater/<rater_id>/create
Query parameters:
session_id
Database id of the session on which to create the new score.
rater_id
Database id of the rater on which to create the new score.
JSON request payload:
ors_score
Field | Description |
---|---|
individually | Number between 0 and 10 (required) |
interpersonally | Number between 0 and 10 (required) |
socially | Number between 0 and 10 (required) |
overall | Number between 0 and 10 (required) |
Response 200, JSON data
Key | Value |
---|---|
data.ors_scores | Array of one of the newly created ORS score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Get SRS scores
Get SRS scores on the session
Get SRS scores from session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/srs_scores/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/sessions/<id>/srs_scores/get
Query parameters:
id
Database id of the session to get SRS scores from.
Response 200, JSON data
Key | Value |
---|---|
data.srs_scores | Array of SRS scores |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create client SRS
Create a client SRS score on a session.
Create SRS score for client with database id 456 on session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/srs_score/client/456/create"
parameters = {
"srs_score": {
"relationship": 4.6,
"goals_and_topics": 7.1,
"approach_or_method": 4.7,
"overall": 5.1,
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<session_id>/srs_scores/client/<client_id>/create
Query parameters:
session_id
Database id of the session on which to create the new score.
client_id
Database id of the client on which to create the new score.
JSON request payload:
srs_score
Field | Description |
---|---|
relationship | Number between 0 and 10 (required) |
goals_and_topics | Number between 0 and 10 (required) |
approach_or_method | Number between 0 and 10 (required) |
overall | Number between 0 and 10 (required) |
Response 200, JSON data
Key | Value |
---|---|
data.srs_scores | Array of one of the newly created SRS score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Create rater SRS
Create a collateral rater SRS score on a session.
Create SRS score for rater with database id 456 on session with database id 123:
url = "https://api.fit-outcomes.com/v1/sessions/123/srs_score/rater/456/create"
parameters = {
"srs_score": {
"relationship": 4.6,
"goals_and_topics": 7.1,
"approach_or_method": 4.7,
"overall": 5.1,
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/sessions/<session_id>/srs_scores/rater/<rater_id>/create
Query parameters:
session_id
Database id of the session on which to create the new score.
rater_id
Database id of the rater on which to create the new score.
JSON request payload:
srs_score
Field | Description |
---|---|
relationship | Number between 0 and 10 (required) |
goals_and_topics | Number between 0 and 10 (required) |
approach_or_method | Number between 0 and 10 (required) |
overall | Number between 0 and 10 (required) |
Response 200, JSON data
Key | Value |
---|---|
data.srs_scores | Array of one of the newly created SRS score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
ORS Score
Get ors_score
Fetch a specific ors_score by database id.
Get ors_score with database id 123:
url = "https://api.fit-outcomes.com/v1/ors_scores/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/ors_scores/<id>/get
Query parameters:
id
Database id of the ors_score to get.
Response 200, JSON data
Key | Value |
---|---|
data.ors_scores | Array of one of ors_score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Update ors_score
Update the specified ors_score.
Update ors_score with database id 123:
url = "https://api.fit-outcomes.com/v1/ors_scores/123/update"
parameters = {
"ors_score": {
"interpersonally": 1.23,
"overall": 4.56
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/ors_score/<id>/update
Query parameters:
id
Database id of the ors_score to update.
JSON request payload:
ors_score
As above
Response 200, JSON data
Key | Value |
---|---|
data.ors_scores | Array of one with the updated ors_score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete ors_score
Delete the specified ors_score.
Delete ors_score with database id 123:
url = "https://api.fit-outcomes.com/v1/ors_scores/123/delete"
}
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/ors_score/<id>/delete
Query parameters:
id
Database id of the ors_score to delete.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
SRS Score
Get srs_score
Fetch a specific srs_score by database id.
Get srs_score with database id 123:
url = "https://api.fit-outcomes.com/v1/srs_scores/123/get"
requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/srs_scores/<id>/get
Query parameters:
id
Database id of the srs_score to get.
Response 200, JSON data
Key | Value |
---|---|
data.srs_scores | Array of one of srs_score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Update srs_score
Update the specified srs_score.
Update srs_score with database id 123:
url = "https://api.fit-outcomes.com/v1/srs_scores/123/update"
parameters = {
"srs_score": {
"relationship": 1.23,
"overall": 4.56
}
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/srs_score/<id>/update
Query parameters:
id
Database id of the srs_score to update.
JSON request payload:
srs_score
As above
Response 200, JSON data
Key | Value |
---|---|
data.srs_scores | Array of one with the updated srs_score |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Delete srs_score
Delete the specified srs_score.
Delete srs_score with database id 123:
url = "https://api.fit-outcomes.com/v1/srs_scores/123/delete"
}
r = requests.post(url, headers=headers)
URL
https://api.fit-outcomes.com/v1/srs_score/<id>/delete
Query parameters:
id
Database id of the srs_score to delete.
Response 200, JSON data
Key | Value |
---|---|
N/A | N/A |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Statistics
Current user statistics
Calculate statistics for the current user.
Calculate all statistics for the current user:
url = "https://api.fit-outcomes.com/v1/statistics/user/get"
requests.post(url, headers=headers)
Calculate statistics for episodes terminated between two dates for the current user:
url = "https://api.fit-outcomes.com/v1/statistics/user/get"
parameters = {
"episode_end_date_1": "2016-01-01",
"episode_end_date_1": "2016-12-31",
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes begun after 02-Feb-2017 and clients with labels 'foo' and 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/user/get"
parameters = {
"episode_start_date_1": "2017-02-02",
"client_labels": ["foo", "bar"],
"client_labels_match_all": True,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes begun before 02-Feb-2017 and clients with labels 'foo' or 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/user/get"
parameters = {
"episode_start_date_2": "2017-02-02",
"client_labels": ["foo", "bar"],
"client_labels_match_all": False,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes with labels 'foo' and 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/user/get"
parameters = {
"episode_labels": ["foo", "bar"],
"episode_labels_match_all": True,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/statistics/user/get
JSON request payload:
episode_start_date_1
Only include episodes that have a start date on or after episode_start_date_1 (string ISO 8601).
episode_start_date_2
Only include episodes that have a start date on or before episode_start_date_2 (string ISO 8601).
episode_end_date_1
Only include episodes that have an end date on or after episode_end_date_1 (string ISO 8601).
episode_end_date_2
Only include episodes that have an end date on or before episode_end_date_2 (string ISO 8601).
client_labels
String array of client labels to match. Empty array will find clients without labels.
client_labels_match_all
If true, all client labels must match, otherwise at least one must match (boolean).
episode_labels
String array of episode labels to match. Empty array will find episodes without labels.
episode_labels_match_all
If true, all episode labels must match, otherwise at least one must match (boolean).
Response 200, JSON data
Key | Value |
---|---|
data.statistics | Statistics |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Specific user statistics
Calculate statistics for a specific user.
Calculate all statistics for user with database id 123:
url = "https://api.fit-outcomes.com/v1/statistics/user/123/get"
requests.post(url, headers=headers)
Calculate statistics for episodes terminated between two dates for user with database id 123:
url = "https://api.fit-outcomes.com/v1/statistics/user/123/get"
parameters = {
"episode_end_date_1": "2016-01-01",
"episode_end_date_1": "2016-12-31",
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes begun after 02-Feb-2017 and clients with labels 'foo' and 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/user/123/get"
parameters = {
"episode_start_date_1": "2017-02-02",
"client_labels": ["foo", "bar"],
"client_labels_match_all": True,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes begun before 02-Feb-2017 and clients with labels 'foo' or 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/user/123/get"
parameters = {
"episode_start_date_2": "2017-02-02",
"client_labels": ["foo", "bar"],
"client_labels_match_all": False,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/statistics/user/<id>/get
Query parameters:
id
Database id of the user to calculate statistics for.
JSON request payload:
As above
Response 200, JSON data
Key | Value |
---|---|
data.statistics | Statistics |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Agency statistics
Calculate statistics for current agency.
Calculate all statistics agency:
url = "https://api.fit-outcomes.com/v1/statistics/agency/get"
requests.post(url, headers=headers)
Calculate statistics for episodes terminated between two dates:
url = "https://api.fit-outcomes.com/v1/statistics/agency/get"
parameters = {
"episode_end_date_1": "2016-01-01",
"episode_end_date_1": "2016-12-31",
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes begun after 02-Feb-2017 and clients with labels 'foo' and 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/agency/get"
parameters = {
"episode_start_date_1": "2017-02-02",
"client_labels": ["foo", "bar"],
"client_labels_match_all": True,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
Calculate statistics for episodes begun before 02-Feb-2017 and clients with labels 'foo' or 'bar:
url = "https://api.fit-outcomes.com/v1/statistics/agency/get"
parameters = {
"episode_start_date_2": "2017-02-02",
"client_labels": ["foo", "bar"],
"client_labels_match_all": False,
}
r = requests.post(url, headers=headers, data=json.dumps(parameters))
URL
https://api.fit-outcomes.com/v1/statistics/agency/get
JSON request payload:
As above
Response 200, JSON data
Key | Value |
---|---|
data.statistics | Statistics |
Response 4xx
Key | Value |
---|---|
error.message | Error description |
Errors
The FIT-Outcomes API uses the following http status codes.
All 4xx errors returned by the API are wrapped in a JSON object describing the error.
{
"error": {
"message": "Something went really really bad"
}
}
Error Code | Meaning |
---|---|
200 | OK -- Your request was succesfully processed. |
202 | Accepted -- Your request will complete at a later time (this is currently not used). |
400 | Bad Request -- There is something wrong with you request. Check the JSON error object. |
401 | Unauthorized -- headers X-Api-Email or X-Api-Token are missing or incorrect. |
403 | Forbidden -- You are not allowed to access the resource (e.g. client). |
404 | Not Found -- The resource (e.g. client) was not found. |
429 | Too Many Requests -- You're are sending too many requests at the same time. |
500 | Internal Server Error -- Internal server error. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |