ButterflyMX API V3

API Endpoint

OAuth2 Authentication

ButterflyMX API V3 implements Resource Owner Credentials (Password) Flow with refresh_token

Obtaining access_token

To obtain a valid access_token and refresh_token, you can send your $CLIENT_ID and Resource Owner’s $USERNAME and $PASSWORD

curl -X POST "https://accountstest.butterflymx.com/oauth/token" \
  -d grant_type=password \
  -d client_id=$CLIENT_ID \
  --data-urlencode "username=$USERNAME"\
  --data-urlencode "password=$PASSWORD"

Response sample in case of success:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "access_token": "eyJ0eXAi...TcV3Q",
    "token_type": "bearer",
    "expires_in": 7200,
    "refresh_token": "6d8cd1d...9f75",
    "created_at": 1506068201
}

Response sample in case that your $CLIENT_ID doesn’t exist:

{
  "error": "invalid_client",
  "error_description": "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."
}

Renewal of the access_token

After access_token expiration, an app can call the same API authentication endpoint to exchange the refresh_token for a new, valid access_token:

curl -X POST "https://accountstest.butterflymx.com/oauth/token" \
  -d grant_type=refresh_token \
  -d refresh_token=6d8cd1d...9f75 \
  -d client_id=$CLIENT_ID

Response sample in case of success:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "access_token": "eyJ0eXAi...",
    "token_type": "bearer",
    "expires_in": 7200,
    "refresh_token": "6d8cd1d...",
    "created_at": 1506068601
}

Note: After successful refresh action, the mobile app has to store new access_token and refresh_token (both are changed)!

Last issued refresh_token doesn’t expire (it is valid indefinitely) but is still subject to invalidation for other reasons. In case that on the renewal request server responds with HTTP status 401, the app should immediately log-off user.

Response status 401, in this case, means that this refresh_token is invalid and refresh operation will not be possible. For example, if the mobile phone is stolen or compromised, the refresh_token can be invalidated on the server side.


User Password Change

Users can change their password by sending a PUT or PATCH request to the ButterflyMX Accounts API. All password change requests need to include the access_token in the Authorization header like this:

curl -X PUT 'https://accounts.butterflymx.com/api/v1/password' \
  -H 'Authorization:Bearer eyJ0eXAi...TcV3Q' \
  --data-urlencode 'account[current_password]=password' \
  --data-urlencode 'account[password]=new_password' \
  --data-urlencode 'account[password_confirmation]=new_password'

In case of the successful password change, the server will return HTTP status 204 No Content.

In case that current password was not correct, the server will respond with a ‘Wrong password’ message in the errors key, like this:

HTTP/1.1 422 Unprocessable Entity
  Content-Type: application/json

  { "errors" : "Wrong password" }

In case of any other errors while updating password, full error messages will be returned. The most common (and probably only) case where this could happen is when there is a password and password_confirmation values mismatch, like this:

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{ "errors" : ["Password confirmation doesn't match Password"] }

User Roles

Authenticated user can have any of the following roles (authorizations):

  • Tenant

  • Unit Admin

  • Zone Admin

  • Building Admin

Data Models

ButterflyMX Building model is divided into zones (e.g., residential, business, etc.). Zones can’t overlap. Each zone can contain many units. A unit can be apartment, office, garage, etc.

  • building has many zones

  • zone belongs to only one building

  • zone has many units

  • unit belongs to only one zone

  • user can be a tenant in many units

  • unit can have many tenants (users)

Building Data Model


JSON API Specification

ButterflyMX API V3 implements latest JSON API Specification (v1.0) published at: http://jsonapi.org/format/

Pagination

Pagination use query parameters such as page[number] and page[size].

For example:

GET https://apitest.butterflymx.com/mobile/v3/door_releases?page[size]=10&?page[number]=2
Accept: application/vnd.api+json

Sorting

Note: Examples are not url-encoded for a better readability

Example:

GET https://apitest.butterflymx.com/mobile/v3/door_releases?sort=name,created_at
Accept: application/vnd.api+json

Multiple Sort You can sort on multiple fields like this:

GET https://apitest.butterflymx.com/mobile/v3/door_releases?sort=name,created_at
Accept: application/vnd.api+json

Descendant Sort Note: The sort order for each attribute is ascending unless it is prefixed with a minus (U+002D HYPHEN-MINUS, -), in which case it is descending.

You can make desc sort with the character - like this:

GET https://apitest.butterflymx.com/mobile/v3/door_releases?sort=-created_at
Accept: application/vnd.api+json

Multiple Sort with Descendant Sort

GET https://apitest.butterflymx.com/mobile/v3/door_releases?sort=-created_at,name
Accept: application/vnd.api+json

The above example should return the newest door releases first. Any door release created on the same moment then be sorted by their name in ascending alphabetical order.

Filtering

Examples:

GET https://apitest.butterflymx.com/mobile/v3/door_releases?unit_id=11
Accept: application/vnd.api+json

or

GET https://apitest.butterflymx.com/mobile/v3/door_releases?unit_id=11&user_id=22
Accept: application/vnd.api+json

Buildings

Buildings

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration* etc.)

List / Show Change Create Delete
Tenant - - - -
Unit Admin - - - -
Zone Admin - - - -
Building Admin - -

Fields that can be changed by the building admin:

  • name (String)

  • time_zone (String)

  • building_type (String)

  • display_name_strategy (String), one of the allowed values:

    • building
    • custom
    • first_name_and_last_name
    • first_name_initial_and_last_name
    • anonymous
    • first_name_and_last_name_initial
  • send_panel_status_report (Boolean)

  • panel_logo (File)

  • mobile_logo (File)

  • remove_panel_logo (Boolean)

  • remove_mobile_logo (Boolean)

  • qr_key_enabled (Boolean)

  • door_release_pin (String)

  • in_unit_phone_number (String)

  • address_1 (String)

  • address_2 (String)

  • city (String)

  • state (String)

  • zip_code (String)

  • phone_number (String)

  • country (String)

GET /v3/buildings
Requestsreturns the list of the buildings

GET  /v3/buildings

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "1",
      "type": "buildings",
      "attributes": {
        "name": "Leuschke LLC-1",
        "building_type": null,
        "display_name_strategy": "anonymous",
        "door_release_pin": false,
        "qr_key_enabled": true,
        "nfc_enabled": false,
        "send_panel_status_report": false,
        "mobile_logo_picture": {
          "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/1/thumb_small_picture.jpg",
          "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/1/medium_small_picture.jpg"
        },
        "panel_logo_picture": {
          "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/1/thumb_small_picture.jpg",
          "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/1/medium_small_picture.jpg"
        },
        "address_1": "6981 Oberbrunner Avenue",
        "address_2": "Port Estelletown, MD 87861-5768",
        "city": "Port Estelletown",
        "state": "Maryland",
        "zip_code": "87861-5768",
        "phone_number": "210-275-8764 x502",
        "country": "United States",
        "time_zone": "Etc/UTC",
        "time_zone_offset": "+00:00"
      },
      "relationships": {
        "zones": {
          "data": [
            {
              "id": "1",
              "type": "zones"
            }
          ]
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/buildings?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/buildings?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/buildings?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

List
GET/v3/buildings


GET /v3/buildings/3
Requestsreturns the building data

GET  /v3/buildings/3

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "3",
    "type": "buildings",
    "attributes": {
      "name": "Dickinson Inc-3",
      "building_type": null,
      "display_name_strategy": "first_name_initial_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": true,
      "nfc_enabled": false,
      "send_panel_status_report": false,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/3/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/3/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/3/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/3/medium_small_picture.jpg"
      },
      "address_1": "68746 Shanahan Street",
      "address_2": "Sengerville, NJ 38519",
      "city": "Sengerville",
      "state": "New Jersey",
      "zip_code": "38519",
      "phone_number": "698.232.5681 x70407",
      "country": "United States",
      "time_zone": "Etc/UTC",
      "time_zone_offset": "+00:00"
    },
    "relationships": {
      "zones": {
        "data": [
          {
            "id": "3",
            "type": "zones"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "3",
      "type": "zones",
      "attributes": {
        "name": "default"
      }
    }
  ]
}

Show
GET/v3/buildings/{id}

URI Parameters
HideShow
id
number (required) Example: 3

PATCH /v3/buildings/5
Requestsupdates the building dataupdates the building addressdoes not update the building addressremoves the panel_logo

PATCH  /v3/buildings/5

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "buildings",
    "id": "5",
    "attributes": {
      "name": "My Building",
      "building_type": "commercial_office",
      "display_name_strategy": "first_name_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": false,
      "send_panel_status_report": true,
      "time_zone": "Eastern Time (US & Canada)"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "5",
    "type": "buildings",
    "attributes": {
      "name": "My Building",
      "building_type": "commercial_office",
      "display_name_strategy": "first_name_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": false,
      "nfc_enabled": false,
      "send_panel_status_report": true,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/5/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/5/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/5/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/5/medium_small_picture.jpg"
      },
      "address_1": "98005 Monahan Spur",
      "address_2": "Soniaport, MT 10684",
      "city": "Soniaport",
      "state": "Montana",
      "zip_code": "10684",
      "phone_number": "(600) 120-8608",
      "country": "United States",
      "time_zone": "Eastern Time (US & Canada)",
      "time_zone_offset": "-05:00"
    },
    "relationships": {
      "zones": {
        "data": [
          {
            "id": "5",
            "type": "zones"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "5",
      "type": "zones",
      "attributes": {
        "name": "default"
      }
    }
  ]
}

PATCH  /v3/buildings/7

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "buildings",
    "id": "7",
    "attributes": {
      "address_1": "New Building Address"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "7",
    "type": "buildings",
    "attributes": {
      "name": "Johnson, Swift and Hills-7",
      "building_type": null,
      "display_name_strategy": "first_name_and_last_name_initial",
      "door_release_pin": false,
      "qr_key_enabled": true,
      "nfc_enabled": false,
      "send_panel_status_report": false,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/7/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/7/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/7/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/panel_logo/7/medium_small_picture.jpg"
      },
      "address_1": "New Building Address",
      "address_2": "Donnellyberg, AL 45563-5778",
      "city": "Donnellyberg",
      "state": "Alabama",
      "zip_code": "45563-5778",
      "phone_number": "(473) 983-7653 x35298",
      "country": "United States",
      "time_zone": "Etc/UTC",
      "time_zone_offset": "+00:00"
    },
    "relationships": {
      "zones": {
        "data": [
          {
            "id": "7",
            "type": "zones"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "7",
      "type": "zones",
      "attributes": {
        "name": "default"
      }
    }
  ]
}

PATCH  /v3/buildings/9

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "buildings",
    "id": "9",
    "attributes": {
      "address_1": ""
    }
  }
}
Responses422
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/address.address_1"
      },
      "detail": "can't be blank"
    }
  ]
}

PATCH  /v3/buildings/11

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "remove_panel_logo": true
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "11",
    "type": "buildings",
    "attributes": {
      "name": "Hammes LLC-11",
      "building_type": null,
      "display_name_strategy": "first_name_initial_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": true,
      "nfc_enabled": false,
      "send_panel_status_report": false,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/11/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/building/mobile_logo/11/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": null,
        "medium_url": null
      },
      "address_1": "915 Diamond Plaza",
      "address_2": "Rowenaburgh, ID 69607-9653",
      "city": "Rowenaburgh",
      "state": "Idaho",
      "zip_code": "69607-9653",
      "phone_number": "1-842-090-9224",
      "country": "United States",
      "time_zone": "Etc/UTC",
      "time_zone_offset": "+00:00"
    },
    "relationships": {
      "zones": {
        "data": [
          {
            "id": "11",
            "type": "zones"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "11",
      "type": "zones",
      "attributes": {
        "name": "default"
      }
    }
  ]
}

Update
PATCH/v3/buildings/{id}

URI Parameters
HideShow
id
number (required) Example: 5

Door Releases

Door Releases

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration* etc.)

List / Show Change Create Delete
Tenant - - -
Unit Admin - - -
Zone Admin - - -
Building Admin - - -

Request Samples with Filter:

GET /v3/door_releases?unit_id=11

GET /v3/door_releases?user_id=22

GET /v3/door_releases?unit_id=11&user_id=22

GET /v3/door_releases?door_release_type=delivery


Request Samples with Sort:

GET /v3/door_releases?sort=created

GET /v3/door_releases?sort=-created,name

The sort order for each attribute is ascending unless it is prefixed with a minus (U+002D HYPHEN-MINUS, “-“), in which case it is descending.


Allowed values for:

  • release_method:

    • mobile
    • panel
    • qr_key
    • nfc
    • voip
  • door_release_type:

    • visitor
    • delivery
  • panel_user_type:

    • default
    • doorman
GET /v3/door_releases
Requestsreturns recent door releases of the tenant's unit

GET  /v3/door_releases

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "12",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "doorman",
        "call_guid": "1fcbe5dd-9217-4563-be15-283c543c687c",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:06Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "11",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "doorman",
        "call_guid": "53340e74-2be6-46ae-bafc-b762a47c5111",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "10",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "216f7924-558e-493d-9c0d-fcba2cfc5bf9",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "9",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "cc1cc59a-de95-49a0-af16-e91a331d0db5",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "8",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "delivery",
        "panel_user_type": "default",
        "call_guid": "1d363e58-77a6-4afa-a305-53d4f6c20dae",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "7",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "delivery",
        "panel_user_type": "default",
        "call_guid": "9abca281-80d0-4acb-9993-2d4c9bc4c136",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "6",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "e9a6852f-b30c-4cb0-95b4-f0c3ebc4426e",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "5",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "6a1ed548-63fb-4b00-96f9-942556e575cd",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "4",
      "type": "door_releases",
      "attributes": {
        "release_method": "qr_key",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "867359a3-e157-451a-8ee4-b194a61f5065",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "3",
      "type": "door_releases",
      "attributes": {
        "release_method": "qr_key",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "039bd518-dfdc-43d7-b6a5-f5bd3465d577",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "2",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "8b1c8e7d-6e8b-49ec-95fd-dcc31cb7b97b",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "1",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "21711426-b699-4c74-a746-b5c70533ba60",
        "name": "Carlie Kuhic",
        "thumb_url": null,
        "medium_url": null,
        "created_at": "2018-02-21T14:34:05Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "19",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "13",
            "type": "users"
          }
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

List
GET/v3/door_releases


Tenants

Tenants

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration, etc.)

List / Show Change Create Delete
Tenant - -
Unit Admin
Zone Admin
Building Admin

Assign User to the Unit as a Tenant

A user is assigned as a unit’s tenant by creating a units-users relationship. This can be achieved with API call: POST /v3/units/:unit_id/users

Required Attributes:

  • email (String) - must be a valid email address

  • first_name (String)

  • last_name (String)

Optional Attributes:

  • active_at (DateTime) - in ISO 8601 format e.g. 2017-12-27T11:03:50Z

  • inactive_at (DateTime)

  • pin (String)

  • directory_message (String)

  • display_name_strategy (String), one of the allowed values:

    • building
    • custom
    • first_name_and_last_name
    • first_name_initial_and_last_name
    • anonymous
    • first_name_and_last_name_initial
  • sms_notifications (boolean)

  • email_notifications (boolean)

  • do_not_disturb (boolean)

When a valid email is submitted, then:

  • if there is no registered user in ButterflyMX having this email, a new user will be created and added as a tenant

  • if there is a registered user with this email, an existing user will be added as a tenant (submitted attributes first_name and last_name will be ignored)

On success, server will respond with a 201 Created status code and a JSON API document

GET /v3/units/64/users
Requestslist the unit's tenants

GET  /v3/units/64/users

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "64",
      "type": "units_users",
      "attributes": {
        "active_at": "2018-02-21T14:34:13Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "National Identity Supervisor",
        "display_name": "Colin Harber",
        "display_name_strategy": "building",
        "display_only_on_search": true,
        "pin_enabled": false,
        "pin": null,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "65",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "41",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "63",
      "type": "units_users",
      "attributes": {
        "active_at": "2018-02-21T14:34:13Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "Product Intranet Consultant",
        "display_name": "Mrs. Joanny Schinner",
        "display_name_strategy": "building",
        "display_only_on_search": false,
        "pin_enabled": false,
        "pin": null,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "64",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "40",
            "type": "users"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "41",
      "type": "users",
      "attributes": {
        "name": "Ward Anderson",
        "first_name": "Ward",
        "last_name": "Anderson",
        "contact_preference": "phone_call",
        "email": "cierra.kris@klingbergnaum.io",
        "sms_phone_number": null,
        "phone_number": null,
        "avatar": {
          "thumb_url": null,
          "medium_url": null
        }
      }
    },
    {
      "id": "40",
      "type": "users",
      "attributes": {
        "name": "Dominique Kiehn",
        "first_name": "Dominique",
        "last_name": "Kiehn",
        "contact_preference": "phone_call",
        "email": "humberto_bosco@mills.name",
        "sms_phone_number": null,
        "phone_number": null,
        "avatar": {
          "thumb_url": null,
          "medium_url": null
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/units/64/users?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/units/64/users?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/units/64/users?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

List
GET/v3/units/{unit_id}/users

URI Parameters
HideShow
unit_id
number (required) Example: 64

POST /v3/units/66/users
Requestscreates the user

POST  /v3/units/66/users

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units_users",
    "attributes": {
      "email": "treie.walsh@runolfsdottir.com",
      "first_name": "Damon",
      "last_name": "Carter",
      "active_at": "2017-12-27T11:03:50Z",
      "pin": "12345",
      "directory_message": "Hi",
      "sms_notifications": true,
      "email_notifications": true,
      "do_not_disturb": false
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "68",
    "type": "units_users",
    "attributes": {
      "active_at": "2017-12-27T11:03:50Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": "Hi",
      "display_name": "Resident 2",
      "display_name_strategy": "building",
      "display_only_on_search": false,
      "pin_enabled": false,
      "pin": "12345",
      "email_notifications": true,
      "sms_notifications": true,
      "do_not_disturb": false
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "66",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "44",
          "type": "users"
        }
      }
    }
  }
}

Create
POST/v3/units/{unit_id}/users

URI Parameters
HideShow
unit_id
number (required) Example: 66

PATCH /v3/units/69/users/45
Requestsupdates the tenant preferences

PATCH  /v3/units/69/users/45

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units_users",
    "attributes": {
      "inactive_at": "2018-02-22T14:34:14Z",
      "pin": "54321",
      "directory_message": "foo",
      "sms_notifications": true,
      "email_notifications": true,
      "do_not_disturb": false
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "69",
    "type": "units_users",
    "attributes": {
      "active_at": "2018-02-21T14:34:14Z",
      "inactive_at": "2018-02-22T14:34:14Z",
      "qr_key_enabled": true,
      "directory_message": "foo",
      "display_name": "Fletcher Bernhard III",
      "display_name_strategy": "building",
      "display_only_on_search": false,
      "pin_enabled": false,
      "pin": "54321",
      "email_notifications": true,
      "sms_notifications": true,
      "do_not_disturb": false
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "69",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "45",
          "type": "users"
        }
      }
    }
  }
}

Update
PATCH/v3/units/{unit_id}/users/{user_id}

URI Parameters
HideShow
unit_id
number (required) Example: 69
user_id
number (required) Example: 45

DELETE /v3/units/72/users/47
Requestsremoves the tenant from the unit

DELETE  /v3/units/72/users/47

Headers
Accept: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/units/{unit_id}/users/{user_id}

URI Parameters
HideShow
unit_id
number (required) Example: 72
user_id
number (required) Example: 47

Units

Units

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration, etc.)

List / Show Change Create Delete
Tenant - - -
Unit Admin - -
Zone Admin
Building Admin

Allowed Values for unit_type:

  • apartment
GET /v3/units
Requestsreturns units where user is tenant

GET  /v3/units

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "50",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "50050",
        "floor_number": 50
      },
      "relationships": {
        "zone": {
          "data": {
            "id": "32",
            "type": "zones"
          }
        },
        "building": {
          "data": {
            "id": "31",
            "type": "buildings"
          }
        },
        "users": {
          "data": [
            {
              "id": "32",
              "type": "users"
            }
          ]
        }
      }
    },
    {
      "id": "47",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "47047",
        "floor_number": 47
      },
      "relationships": {
        "zone": {
          "data": {
            "id": "32",
            "type": "zones"
          }
        },
        "building": {
          "data": {
            "id": "31",
            "type": "buildings"
          }
        },
        "users": {
          "data": [
            {
              "id": "32",
              "type": "users"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "id": "32",
      "type": "zones",
      "attributes": {
        "name": "default"
      }
    },
    {
      "id": "32",
      "type": "users",
      "attributes": {
        "name": "Tomas Blick",
        "first_name": "Tomas",
        "last_name": "Blick",
        "contact_preference": "phone_call",
        "email": "madaline@goodwingreen.com",
        "sms_phone_number": null,
        "phone_number": null,
        "avatar": {
          "thumb_url": null,
          "medium_url": null
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/units?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/units?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/units?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

List
GET/v3/units


GET /v3/units/51
Requestsreturns the unit data

GET  /v3/units/51

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "51",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "51051",
      "floor_number": 51
    },
    "relationships": {
      "zone": {
        "data": {
          "id": "34",
          "type": "zones"
        }
      },
      "building": {
        "data": {
          "id": "33",
          "type": "buildings"
        }
      },
      "users": {
        "data": [
          {
            "id": "34",
            "type": "users"
          }
        ]
      }
    }
  }
}

Show
GET/v3/units/{id}

URI Parameters
HideShow
id
number (required) Example: 51

POST /v3/units
Requestscreates the unit

POST  /v3/units

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "foo",
      "floor_number": 11
    },
    "relationships": {
      "zone": {
        "data": {
          "id": "36"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "59",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "foo",
      "floor_number": 11
    },
    "relationships": {
      "zone": {
        "data": {
          "id": "36",
          "type": "zones"
        }
      },
      "building": {
        "data": {
          "id": "35",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

Create
POST/v3/units


PATCH /v3/units/60
Requestsupdates the unit

PATCH  /v3/units/60

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units",
    "id": "60",
    "attributes": {
      "label": "updated"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "60",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "updated",
      "floor_number": 59
    },
    "relationships": {
      "zone": {
        "data": {
          "id": "38",
          "type": "zones"
        }
      },
      "building": {
        "data": {
          "id": "37",
          "type": "buildings"
        }
      },
      "users": {
        "data": [
          {
            "id": "38",
            "type": "users"
          }
        ]
      }
    }
  }
}

Update
PATCH/v3/units/{id}

URI Parameters
HideShow
id
number (required) Example: 60

Virtual Keys

Keychains

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration, etc.)

List / Show Change Create Delete
Tenant
Unit Admin
Zone Admin
Building Admin

You can create a single QR Key, like this:

POST /v3/qr_keys HTTP/1.1
Authorization: Bearer eyJ0eXAi...TcV3Q
Content-Type: application/vnd.api+json

{
  "data": {
    "type": "qr_keys",
    "attributes": {
      "name": "mykey",
      "email": "foo@bar.baz",
      "activated_at": "2017-11-29T21:01:00Z",
      "expired_at": "2017-11-29T21:06:00Z",
    },
    "relationships": {
      "unit": {"data": {"id": "11"}},
      "user": {"data": {"id": "22"}}
    }
  }
}

… or, you can create many QR Keys with the same properties (validity), by creating a keychain first, like this:

POST /v3/keychains HTTP/1.1
Authorization: Bearer eyJ0eXAi...TcV3Q
Content-Type: application/vnd.api+json

{
  "data": {
    "type": "keychains",
    "attributes": {
      "name": "foo",
      "weekdays": ["mon","fri"],
      "valid_date_from": "2017-08-01",
      "valid_date_to": "2017-08-21",
      "valid_time_from": "11:00:00",
      "valid_time_to": "15:50:00",
    },
    "relationships": {
      "unit": {"data": {"id": "11"}},
      "user": {"data": {"id": "22"}}
    }
  }
}

… and then, add more qr_keys to that keychain, like this:

POST /v3/keychains/{keychain_id}/qr_keys HTTP/1.1
Authorization: Bearer eyJ0eXAi...TcV3Q
Content-Type: application/vnd.api+json

{
  "data": {
    "type": "qr_keys",
    "attributes": {
      "name": "My Key",
      "email": "foo@bar.baz",
      "sms_number": "+15005550006"
    }
  }
}

Allowed Values for weekdays:

  • mon

  • tue

  • wed

  • thu

  • fri

  • sat

  • sun

Note: At least email or sms_number must be defined for a new QR Key.

GET /v3/keychains
Requestsreturns all keychains

GET  /v3/keychains

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "4",
      "type": "keychains",
      "attributes": {
        "name": "Customer Group Planner 4",
        "weekdays": null,
        "valid_date_from": "2018-03-08",
        "valid_date_to": "2018-03-08",
        "valid_time_from": "10:00:00",
        "valid_time_to": "23:25:00"
      },
      "relationships": {
        "user": {
          "data": {
            "id": "16",
            "type": "users"
          }
        },
        "unit": {
          "data": {
            "id": "23",
            "type": "units"
          }
        }
      }
    },
    {
      "id": "3",
      "type": "keychains",
      "attributes": {
        "name": "Future Optimization Consultant 3",
        "weekdays": null,
        "valid_date_from": "2018-02-11",
        "valid_date_to": "2018-03-08",
        "valid_time_from": "10:00:00",
        "valid_time_to": "23:25:00"
      },
      "relationships": {
        "user": {
          "data": {
            "id": "16",
            "type": "users"
          }
        },
        "unit": {
          "data": {
            "id": "23",
            "type": "units"
          }
        }
      }
    },
    {
      "id": "2",
      "type": "keychains",
      "attributes": {
        "name": "Human Group Representative 2",
        "weekdays": null,
        "valid_date_from": "2018-02-16",
        "valid_date_to": "2018-03-08",
        "valid_time_from": "10:00:00",
        "valid_time_to": "23:25:00"
      },
      "relationships": {
        "user": {
          "data": {
            "id": "16",
            "type": "users"
          }
        },
        "unit": {
          "data": {
            "id": "23",
            "type": "units"
          }
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

List
GET/v3/keychains


GET /v3/keychains/5
Requestsreturns the keychain data

GET  /v3/keychains/5

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "5",
    "type": "keychains",
    "attributes": {
      "name": "Regional Identity Facilitator 5",
      "weekdays": null,
      "valid_date_from": "2018-02-16",
      "valid_date_to": "2018-03-08",
      "valid_time_from": "10:00:00",
      "valid_time_to": "23:25:00"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "18",
          "type": "users"
        }
      },
      "unit": {
        "data": {
          "id": "26",
          "type": "units"
        }
      }
    }
  }
}

Show
GET/v3/keychains/{id}

URI Parameters
HideShow
id
number (required) Example: 5

DELETE /v3/keychains/6
Requestsdestroys the keychain

DELETE  /v3/keychains/6

Headers
Accept: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/keychains/{id}

URI Parameters
HideShow
id
number (required) Example: 6

QR Keys

GET /v3/qr_keys
Requestsreturns all virtual keysreturns all virtual keys on the keychain

GET  /v3/qr_keys

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "4",
      "type": "qr_keys",
      "attributes": {
        "name": "Noel Deckow V",
        "email": "austin_schimmel@example.com",
        "sms_number": "+12546239731",
        "key_code": "od6eym5",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/4/thumb/qr_code_20180221-26752-9jm09c.png",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/4/medium/qr_code_20180221-26752-9jm09c.png",
        "large_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/4/large/qr_code_20180221-26752-9jm09c.png",
        "activated_at": "2018-03-08T10:00:00Z",
        "expired_at": "2018-03-08T23:25:00Z"
      },
      "relationships": {
        "keychain": {
          "data": {
            "id": "9",
            "type": "keychains"
          }
        },
        "unit": {
          "data": {
            "id": "32",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "22",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "3",
      "type": "qr_keys",
      "attributes": {
        "name": "Roberta Brekke",
        "email": "arjun@example.org",
        "sms_number": "+12546239734",
        "key_code": "sgy57m9",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/3/thumb/qr_code_20180221-26752-o9xhdd.png",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/3/medium/qr_code_20180221-26752-o9xhdd.png",
        "large_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/3/large/qr_code_20180221-26752-o9xhdd.png",
        "activated_at": "2018-02-11T10:00:00Z",
        "expired_at": "2018-03-08T23:25:00Z"
      },
      "relationships": {
        "keychain": {
          "data": {
            "id": "8",
            "type": "keychains"
          }
        },
        "unit": {
          "data": {
            "id": "32",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "22",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "2",
      "type": "qr_keys",
      "attributes": {
        "name": "Bryce King Jr.",
        "email": "germaine.jakubowski@example.com",
        "sms_number": "+12546239733",
        "key_code": "bbctq5i",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/2/thumb/qr_code_20180221-26752-1qivci0.png",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/2/medium/qr_code_20180221-26752-1qivci0.png",
        "large_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/2/large/qr_code_20180221-26752-1qivci0.png",
        "activated_at": "2018-02-16T10:00:00Z",
        "expired_at": "2018-03-08T23:25:00Z"
      },
      "relationships": {
        "keychain": {
          "data": {
            "id": "7",
            "type": "keychains"
          }
        },
        "unit": {
          "data": {
            "id": "32",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "22",
            "type": "users"
          }
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/qr_keys?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/qr_keys?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/qr_keys?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

GET  /v3/keychains/10/qr_keys

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "5",
      "type": "qr_keys",
      "attributes": {
        "name": "Cristopher Torp",
        "email": "mario@example.org",
        "sms_number": "+12546239733",
        "key_code": "eqjws1i",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/5/thumb/qr_code_20180221-26752-kdbfz4.png",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/5/medium/qr_code_20180221-26752-kdbfz4.png",
        "large_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/5/large/qr_code_20180221-26752-kdbfz4.png",
        "activated_at": "2018-02-16T10:00:00Z",
        "expired_at": "2018-03-08T23:25:00Z"
      },
      "relationships": {
        "keychain": {
          "data": {
            "id": "10",
            "type": "keychains"
          }
        },
        "unit": {
          "data": {
            "id": "35",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "24",
            "type": "users"
          }
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/keychains/10/qr_keys?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "first": "http://api.butterflymx.com/v3/keychains/10/qr_keys?page%5Bnumber%5D=1&page%5Bsize%5D=100",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/keychains/10/qr_keys?page%5Bnumber%5D=1&page%5Bsize%5D=100"
  }
}

List
GET/v3/qr_keys


GET /v3/qr_keys/8
Requestsreturns the key data

GET  /v3/qr_keys/8

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "8",
    "type": "qr_keys",
    "attributes": {
      "name": "Mrs. Nickolas Wolff",
      "email": "catherine.robel@example.com",
      "sms_number": "+12546239737",
      "key_code": "zswqbci",
      "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/8/thumb/qr_code_20180221-26752-14u3jv7.png",
      "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/8/medium/qr_code_20180221-26752-14u3jv7.png",
      "large_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/8/large/qr_code_20180221-26752-14u3jv7.png",
      "activated_at": "2018-02-16T10:00:00Z",
      "expired_at": "2018-03-08T23:25:00Z"
    },
    "relationships": {
      "keychain": {
        "data": {
          "id": "13",
          "type": "keychains"
        }
      },
      "unit": {
        "data": {
          "id": "38",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "26",
          "type": "users"
        }
      }
    }
  }
}

Show
GET/v3/qr_keys/{id}

URI Parameters
HideShow
id
number (required) Example: 8

POST /v3/keychains/14/qr_keys
Requestscreates the key

POST  /v3/keychains/14/qr_keys

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "qr_keys",
    "attributes": {
      "name": "mykey",
      "email": "foo@bar.baz",
      "activated_at": "2017-11-29T21:01:00",
      "expired_at": "2017-11-29T21:06:00"
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "41"
        }
      },
      "user": {
        "data": {
          "id": "28"
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "10",
    "type": "qr_keys",
    "attributes": {
      "name": "mykey",
      "email": "foo@bar.baz",
      "sms_number": null,
      "key_code": "eas4k0n",
      "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/10/thumb/qr_code_20180221-26752-bqefv5.png",
      "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/10/medium/qr_code_20180221-26752-bqefv5.png",
      "large_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/qr_key/qr_code_image/10/large/qr_code_20180221-26752-bqefv5.png",
      "activated_at": "2018-02-16T10:00:00Z",
      "expired_at": "2018-03-08T23:25:00Z"
    },
    "relationships": {
      "keychain": {
        "data": {
          "id": "14",
          "type": "keychains"
        }
      },
      "unit": {
        "data": {
          "id": "41",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "28",
          "type": "users"
        }
      }
    }
  }
}

Create
POST/v3/keychains/{keychain_id}/qr_keys

URI Parameters
HideShow
keychain_id
number (required) Example: 14

DELETE /v3/qr_keys/11
Requestsdestroys the key

DELETE  /v3/qr_keys/11

Headers
Accept: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/qr_keys/{id}

URI Parameters
HideShow
id
number (required) Example: 11

Generated by aglio on 21 Feb 2018