|
| 1 | +# BlinkMonitorProtocol |
| 2 | +Unofficial documentation for the Client API of the Blink Wire-Free HD Home Monitoring and Alert System. |
| 3 | + |
| 4 | +Copied from https://github.com/MattTW/BlinkMonitorProtocol |
| 5 | + |
| 6 | +I am not affiliated with the company in any way - this documentation is strictly **"AS-IS"**. My goal was to uncover enough to arm and disarm the system programatically so that I can issue those commands in sync with my home alarm system arm/disarm. Just some raw notes at this point but should be enough for creating programmatic APIs. Lots more to be discovered and documented - feel free to contribute! |
| 7 | + |
| 8 | +The Client API is a straightforward REST API using JSON and HTTPS. |
| 9 | + |
| 10 | +## This Document |
| 11 | +The purpose here is to describe what is going on behind the scenes, and what commands we know are available to communicate with Blink servers. This is NOT a description of the blinkpy module, but a description of the commands blinkpy relies on to effectively communicate. |
| 12 | + |
| 13 | +##Login |
| 14 | + |
| 15 | +Client login to the Blink Servers. |
| 16 | + |
| 17 | +**Request:** |
| 18 | +>curl -H "Host: prod.immedia-semi.com" -H "Content-Type: application/json" --data-binary '{ |
| 19 | +> "password" : "*your blink password*", |
| 20 | +> "client_specifier" : "iPhone 9.2 | 2.2 | 222", |
| 21 | +> "email" : "*your blink login/email*" |
| 22 | +>}' --compressed https://prod.immedia-semi.com/login |
| 23 | +
|
| 24 | +**Response:** |
| 25 | +>{"authtoken":{"authtoken":"*an auth token*","message":"auth"}} |
| 26 | +
|
| 27 | +**Notes:** |
| 28 | +The authtoken value is passed in a header in future calls. |
| 29 | + |
| 30 | +##Networks |
| 31 | + |
| 32 | +Obtain information about the Blink networks defined for the logged in user. |
| 33 | + |
| 34 | +**Request:** |
| 35 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/networks |
| 36 | +
|
| 37 | +**Response:** |
| 38 | +JSON response containing information including Network ID and Account ID. |
| 39 | + |
| 40 | +**Notes:** |
| 41 | +Network ID is needed to issue arm/disarm calls |
| 42 | + |
| 43 | + |
| 44 | +##Sync Modules |
| 45 | + |
| 46 | +Obtain information about the Blink Sync Modules on the given network. |
| 47 | + |
| 48 | +**Request:** |
| 49 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/network/*network_id_from_networks_call*/syncmodules |
| 50 | +
|
| 51 | +**Response:** |
| 52 | +JSON response containing information about the known state of the Sync module, most notably if it is online |
| 53 | + |
| 54 | +**Notes:** |
| 55 | +Probably not strictly needed but checking result can verify that the sync module is online and will respond to requests to arm/disarm, etc. |
| 56 | + |
| 57 | + |
| 58 | +##Arm |
| 59 | + |
| 60 | +Arm the given network (start recording/reporting motion events) |
| 61 | + |
| 62 | +**Request:** |
| 63 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --data-binary --compressed https://prod.immedia-semi.com/network/*network_id_from_networks_call*/arm |
| 64 | +
|
| 65 | +**Response:** |
| 66 | +JSON response containing information about the arm command request, including the command/request ID |
| 67 | + |
| 68 | +**Notes:** |
| 69 | +When this call returns, it does not mean the arm request is complete, the client must gather the request ID from the response and poll for the status of the command. |
| 70 | + |
| 71 | +##Disarm |
| 72 | + |
| 73 | +Disarm the given network (stop recording/reporting motion events) |
| 74 | + |
| 75 | +**Request:** |
| 76 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --data-binary --compressed https://prod.immedia-semi.com/network/*network_id_from_networks_call*/disarm |
| 77 | +
|
| 78 | +**Response:** |
| 79 | +JSON response containing information about the disarm command request, including the command/request ID |
| 80 | + |
| 81 | +**Notes:** |
| 82 | +When this call returns, it does not mean the disarm request is complete, the client must gather the request ID from the response and poll for the status of the command. |
| 83 | + |
| 84 | + |
| 85 | +##Command Status |
| 86 | + |
| 87 | +Get status info on the given command |
| 88 | + |
| 89 | +**Request:** |
| 90 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/network/*network_id*/command/*command_id* |
| 91 | +
|
| 92 | +**Response:** |
| 93 | +JSON response containing state information of the given command, most notably whether it has completed and was successful. |
| 94 | + |
| 95 | +**Notes:** |
| 96 | +After an arm/disarm command, the client appears to poll this URL every second or so until the response indicates the command is complete. |
| 97 | + |
| 98 | +**Known Commands:** |
| 99 | +lv_relay, arm, disarm, thumbnail, clip |
| 100 | + |
| 101 | +##Home Screen |
| 102 | + |
| 103 | +Return information displayed on the home screen of the mobile client |
| 104 | + |
| 105 | +**Request:** |
| 106 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/homescreen |
| 107 | +
|
| 108 | +**Response:** |
| 109 | +JSON response containing information that the mobile client displays on the home page, including: status, armed state, links to thumbnails for each camera, etc. |
| 110 | + |
| 111 | +**Notes:** |
| 112 | +Not necessary to as part of issuing arm/disarm commands, but contains good summary info. |
| 113 | + |
| 114 | +##Events, thumbnails & video captures |
| 115 | + |
| 116 | +**Request** |
| 117 | +Get events for a given network (sync module) -- Need network ID from home |
| 118 | + |
| 119 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/events/network/*network__id* |
| 120 | +
|
| 121 | +**Response** |
| 122 | +A json list of evets incluing URL's. Replace the "mp4" with "jpg" extension to get the thumbnail of each clip |
| 123 | + |
| 124 | + |
| 125 | +**Request** |
| 126 | +Get a video clip from the events list |
| 127 | + |
| 128 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed **video url from events list.mp4** > video.mp4 |
| 129 | +
|
| 130 | +**Response** |
| 131 | +The mp4 video |
| 132 | + |
| 133 | +**Request** |
| 134 | +Get a thumbnail from the events list |
| 135 | + |
| 136 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed **video url from events list.jpg** > video_thumb.jpg |
| 137 | +
|
| 138 | +**Response** |
| 139 | +The jpg bytes. |
| 140 | + |
| 141 | +**Notes** |
| 142 | +Note that you replace the 'mp4' with a 'jpg' to get the thumbnail |
| 143 | + |
| 144 | +**Request** |
| 145 | +Captures a new thumbnail for a camera |
| 146 | + |
| 147 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --data-binary --compressed https://prod.immedia-semi.com/network/*network_id*/camera/*camera_id*/thumbnail |
| 148 | +
|
| 149 | +**Response** |
| 150 | +Command information. |
| 151 | + |
| 152 | +**Request** |
| 153 | +Captures a new video for a camera |
| 154 | + |
| 155 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --data-binary --compressed https://prod.immedia-semi.com/network/*network_id*/camera/*camera_id*/clip |
| 156 | +
|
| 157 | +**Response** |
| 158 | +Command information. |
| 159 | + |
| 160 | +##Video Information |
| 161 | + |
| 162 | +**Request** |
| 163 | +Get the total number of videos in the system |
| 164 | + |
| 165 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/api/v2/videos/count |
| 166 | +
|
| 167 | +**Response** |
| 168 | +JSON response containing the total video count. |
| 169 | + |
| 170 | +**Request** |
| 171 | +Gets a paginated set of video information |
| 172 | + |
| 173 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/api/v2/videos/page/0 |
| 174 | +
|
| 175 | +**Response** |
| 176 | +JSON response containing a set of video information, including: camera name, creation time, thumbnail URI, size, length |
| 177 | + |
| 178 | +**Request** |
| 179 | +Gets information for a specific video by ID |
| 180 | + |
| 181 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/api/v2/video/*video_id* |
| 182 | +
|
| 183 | +**Response** |
| 184 | +JSON response containing video information |
| 185 | + |
| 186 | +**Request** |
| 187 | +Gets a list of unwatched videos |
| 188 | + |
| 189 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/api/v2/videos/unwatched |
| 190 | +
|
| 191 | +**Response** |
| 192 | +JSON response containing unwatched video information |
| 193 | + |
| 194 | +**Request** |
| 195 | +Deletes a video |
| 196 | + |
| 197 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --data-binary --compressed https://prod.immedia-semi.com/api/v2/video/*video_id*/delete |
| 198 | +
|
| 199 | +**Response** |
| 200 | +Unknown - not tested |
| 201 | + |
| 202 | +**Request** |
| 203 | +Deletes all videos |
| 204 | + |
| 205 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --data-binary --compressed https://prod.immedia-semi.com/api/v2/videos/deleteall |
| 206 | +
|
| 207 | +**Response** |
| 208 | +Unknown - not tested |
| 209 | + |
| 210 | +##Cameras |
| 211 | + |
| 212 | +**Request** |
| 213 | +Gets a list of cameras |
| 214 | + |
| 215 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/network/*network_id*/cameras |
| 216 | +
|
| 217 | +**Response** |
| 218 | +JSON response containing camera information |
| 219 | + |
| 220 | +**Request** |
| 221 | +Gets information for one camera |
| 222 | + |
| 223 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/network/*network_id*/camera/*camera_id* |
| 224 | +
|
| 225 | +**Response** |
| 226 | +JSON response containing camera information |
| 227 | + |
| 228 | +**Request** |
| 229 | +Gets camera sensor information |
| 230 | + |
| 231 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/network/*network_id*/camera/*camera_id*/signals |
| 232 | +
|
| 233 | +**Response** |
| 234 | +JSON response containing camera sensor information, such as wifi strength, temperature, and battery level |
| 235 | + |
| 236 | +**Request** |
| 237 | +Enables motion detection for one camera |
| 238 | + |
| 239 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: $auth_token" --data-binary --compressed https://prod.immedia-semi.com/network/*network_id*/camera/*camera_id*/enable |
| 240 | +
|
| 241 | +**Response** |
| 242 | +JSON response containing camera information |
| 243 | + |
| 244 | +**Request** |
| 245 | +Disables motion detection for one camera |
| 246 | + |
| 247 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: $auth_token" --data-binary --compressed https://prod.immedia-semi.com/network/*network_id*/camera/*camera_id*/disable |
| 248 | +
|
| 249 | +**Response** |
| 250 | +JSON response containing camera information |
| 251 | + |
| 252 | +*Note*: enabling or disabling motion detection is independent of arming or disarming the system. No motion detection or video recording will take place unless the system is armed. |
| 253 | + |
| 254 | + |
| 255 | +##Miscellaneous |
| 256 | + |
| 257 | +**Request** |
| 258 | +Gets information about devices that have connected to the blink service |
| 259 | + |
| 260 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/account/clients |
| 261 | +
|
| 262 | +**Response** |
| 263 | +JSON response containing client information, including: type, name, connection time, user ID |
| 264 | + |
| 265 | +**Request** |
| 266 | +Gets information about supported regions |
| 267 | + |
| 268 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/regions |
| 269 | +
|
| 270 | +**Response** |
| 271 | +JSON response containing region information |
| 272 | + |
| 273 | +**Request** |
| 274 | +Gets information about system health |
| 275 | + |
| 276 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/health |
| 277 | +
|
| 278 | +**Response** |
| 279 | +"all ports tested are open" |
| 280 | + |
| 281 | +**Request** |
| 282 | +Gets information about programs |
| 283 | + |
| 284 | +>curl -H "Host: prod.immedia-semi.com" -H "TOKEN_AUTH: *authtoken from login*" --compressed https://prod.immedia-semi.com/api/v1/networks/*network_id*/programs |
| 285 | +
|
| 286 | +**Response** |
| 287 | +Unknown. |
0 commit comments