Skip to content

Instantly share code, notes, and snippets.

@leptos-null
Created April 12, 2020 16:56
Show Gist options
  • Save leptos-null/d663802b663def167bf4c4c736d7e41f to your computer and use it in GitHub Desktop.
Save leptos-null/d663802b663def167bf4c4c736d7e41f to your computer and use it in GitHub Desktop.
Red Cross Blood REST API Reference

Red Cross Blood REST API Reference

This guide is based on research from version 1.7.3 of Red Cross Blood iOS app.

Host: blood.arc.cubeapis.com

This reference is for version 2.1 of the interface.

Authentication

Unless otherwise specified, all requests must be made with an Authorization header. The format is Authorization: Local TOKEN

To get a token for a user

POST /v2.1/authentication

Request:

{
    "username" : String,
    "password" : String
}

Response:

{
    "token": String,
    "expires" : Date
}

Users

Where USER_ID is a user id or me to symbolically reference the authenticated user.

User

Takes a parameter: inflate, the value is a comma-delimited list of sub-endpoints.

GET /v2.1/users/USER_ID

Many elements of a user are mutable. To leave a team, set teamId to 0.

POST /v2.1/users/USER_ID

Request:

{
   "username" : String,
   "email" : String,
   "firstName" : String,
   "lastName" : String,
   "dob" : Date,
   "bloodType" : String,
   "teamId" : TEAM_ID,
   "eligible" : bool,
   "address" : {
      "line1" : String,
      "locality" : String,
      "city" : String,
      "state" : String,
      "postalCode" : String
   },
   "settings" : {
      "preferences" : {
         "contact" : String,
         "phone" : String
      },
      "notifications" : {
         "sms" : bool,
         "email" : bool,
         "push" : {
            "donors" : bool,
            "rewards" : bool,
            "journey" : bool,
            "reminders" : {
               "booking" : bool,
               "pass" : bool,
               "appointment" : bool,
               "selfie" : bool,
               "eligible" : bool,
               "cart" : bool
            }
         }
      }
   },
   "phone" : {
      "mobile" : String,
      "home" : String,
      "work" : String
   }
}

History

Provides an overview of the user's activity.

GET /v2.1/users/USER_ID/history

Cloud

GET /v2.1/users/USER_ID/cloud

Devices

An array of authenticated devices

GET /v2.1/users/USER_ID/devices

Authorization for a given DEVICE_ID may be revoked

DELETE /v2.1/devices/DEVICE_ID

Journeys

A journey refers to the state of a blood donation (e.g. "In storage")

GET /v2.1/users/USER_ID/journeys

Appointments

Current user appointments

GET /v2.1/users/USER_ID/appointments

Create appointment

POST /v2.1/users/USER_ID/appointments

Request:

{
   "type" : String,
   "timestamp" : Date,
   "timeSlotId" : SLOT_ID
}

Donations

Takes a required URL (query) parameter: limit, the value is a decimal integer between 0 and 100 inclusive.

GET /v2.1/users/USER_ID/donations

Teams

Teams

The list of teams from START to END inclusive, where index 0 is the team with the greatest potential lives saved. If no RANGE is provided, 7 teams are returned, enclosing the team of the authenticated account, if possible (e.g. if the team of the authenticated user is ranked 12, teams 9-15 would be returned; if the user is within the top 3 teams, the top 7 teams are returned).

GET /v2.1/teams

Range: indices=START-END

Note: The Content-Range response header indicates the total team count.

Team

Info for a specific TEAM_ID

GET /v2.1/teams/TEAM_ID

Search

Search for a team with a given TERM

POST /v2.1/teams/search?term=TERM

Drives

Search

POST /v2.1/drives/search

Request:

bounds.coordinates should be [ longitude, latitude ]

bounds.radius should be in meters

bounds.type should be "Circle"

{
   "type" : String,
   "sort" : String,
   "limit" : int,
   "range" : {
      "from" : Date,
      "to" : Date
   },
   "bounds" : {
      "type" : String,
      "radius" : double,
      "coordinates" : [ double ]
   }
}

Appointments

An array of upcoming appointments at a given DRIVE_ID

GET /v2.1/drives/DRIVE_ID/appointments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment