僕が使っている監視カメラの arloにはAPIがあるようなので使ってみます。
API
ArloでAPIを利用する場合、最初にトークン生成をし、そのトークンを利用して様々なリクエストをすることになります
レスポンス
ユーザ情報の取得
リクエスト
レスポンス
レスポンス
ロケーション情報の取得
リクエスト
レスポンス
デバイス情報の取得
リクエスト
presignedContentUrl の情報にアクセスすると動画データを取得することができる
参考URL
http://www.robertogallea.com/blog/netgear-arlo-apiAPI
ArloでAPIを利用する場合、最初にトークン生成をし、そのトークンを利用して様々なリクエストをすることになりますトークン生成
リクエストcurl -H "Content-Type: application/json;charset=UTF-8" -d '{"email":"YOUR_EMAIL","password":"YOUR_PASSWORD"}' -X POST "https://arlo.netgear.com/hmsweb/login/v2"
レスポンス
{ "data": { "userId": "XXXX", "email": "XXXX", "token": "XXXX", "paymentId": "XXXX", "authenticated": XXXX, "accountStatus": "registered", "serialNumber": "XXXX", "countryCode": "JP", "tocUpdate": false, "policyUpdate": false, "appStore": { "updateLink": "https://play.google.com/store/apps/details?id=com.netgear.android", "enforce": false, "latestVersion": "2.4.0" }, "validEmail": true, "arlo": true, "dateCreated": 1498259207374 }, "success": true }
ユーザ情報の取得
リクエスト
curl -H "Authorization: XXXXX" -X GET "https://arlo.netgear.com/hmsweb/users/profile"
レスポンス
{ "data": { "_type": "User", "firstName": "XXXX ", "lastName": "XXXX", "language": "ja", "country": "JP", "acceptedPolicy": 1, "currentPolicy": 1, "validEmail": true }, "success": true }
メンバー情報の取得
リクエストcurl -H "Authorization: XXXXXX" -X GET "https://arlo.netgear.com/hmsweb/users/friends"
レスポンス
{ "data": [ { "ownerId": "XXXXXX", "createdDate": 1498270223291, "token": "XXXXXX", "firstName": "XXXXXX", "lastName": "XXXXXX", "devices": [ { "deviceId": "XXXXXX", "modifiedDate": 1498270715040, "deviceName": "XXXXXX", "uniqueId": "XXXXXX" }, { "deviceId": "XXXXXX", "modifiedDate": 1498270715040, "deviceName": "XXXXXX", "uniqueId": "XXXXXX" }, { "deviceId": "XXXXXX", "modifiedDate": 1498270715040, "deviceName": "XXXXXX", "uniqueId": "XXXXXX" } ], "lastModified": 1498270223291, "status": "ACCEPTED", "adminUser": true, "email": "XXXXXX", "id": "XXXXXX" } ], "success": true }
ロケーション情報の取得
リクエストcurl -H "Authorization: XXXXXXX" -X GET "https://arlo.netgear.com/hmsweb/users/locations"レスポンス
{ "data": [ { "id": "XXXXXXXXXXXXX", "name": "家", "ownerId": "XXXXXXXXXXXXX", "longitude": XXXXXXXXXXXXX, "latitude": XXXXXXXXXXXXX, "address": "XXXXXXXXXXXXX", "homeMode": "mode0", "awayMode": "mode1", "geoEnabled": true, "geoRadius": 150, "uniqueIds": [ "XXXXXXXXXXXXX" ], "smartDevices": [ "XXXXXXXXXXXXX", "XXXXXXXXXXXXX" ], "pushNotifyDevices": [ "XXXXXXXXXXXXX" ] } ], "success": true }
サービスレベルの取得
リクエストcurl -H "Authorization: XXXXXXX" -X GET "https://arlo.netgear.com/hmsweb/users/serviceLevel/v2"
レスポンス
{ "data": { "plans": [ { "planId": "XXXXXXX", "planName": "Basic", "planType": "BASIC", "maxBaseStations": -1, "maxCameras": 5, "numPushNotify": -1, "maxSmartHomeModes": -1, "maxAccounts": -1, "maxStorage": -1, "groupNumber": 0, "groupName": "Basic", "createdDate": 1498259210464, "lastModified": 1498259210464, "expiryDate": null, "daysLeftForExpiry": null, "billingDate": null, "term": 12, "planAmount": 0, "plansTotalCurrencyAmount": "\0.00/Yr", "planCurrencyAmount": "¥0.00", "planUpgradeable": true, "userPreferences": { "storage": { "enabled": true, "autoDelete": false }, "alerts": { "storageAlert": false, "lowBatteryAlert": true, "pushNotificationAlert": true, "pushNotificationCount": -1 } }, "libraryAccessExpiry": 7, "cvrAccessExpiry": 7, "sharing": true, "schedule": true, "sharingExpiry": -1, "scheduleExpiry": -1, "display": "FREE", "isBusiness": null, "planCapacity": null, "maxE911Locations": null, "uniqueIds": null, "displayStorage": null, "isTrialPlan": null, "rollOverPlanId": null } ], "discovery": {} }, "success": true }
デバイス情報の取得
リクエストcurl -H "Authorization: XXXXXX" -X GET "https://arlo.netgear.com/hmsweb/users/devices"レスポンス
{ "data": [ { "userId": "XXXXXXX", "deviceId": "XXXXXXX", "uniqueId": "XXXXXXX", "deviceType": "basestation", "deviceName": "XXXXXXX", "lastModified": 1540952269305, "firmwareVersion": "1.12.0.0_27099", "xCloudId": "XXXXXXX", "userRole": "OWNER", "displayOrder": 3, "mediaObjectCount": 0, "state": "provisioned", "modelId": "VMB4000", "dateCreated": 1498259212120, "arloMobilePlan": false, "interfaceVersion": "i007", "interfaceSchemaVer": "8", "owner": { "firstName": "XXXXXXX ", "lastName": "XXXXXXX", "ownerId": "XXXXXXX" }, "properties": { "modelId": "VMB4000", "olsonTimeZone": "Asia/Tokyo", "hwVersion": "VMB4000r3" }, "connectivity": { "type": "ethernet", "connected": true, "mepStatus": "unknown" }, "automationRevision": 0 }, { "userId": "XXXXXXX", "deviceId": "XXXXXXX", "parentId": "XXXXXXX", "uniqueId": "XXXXXXX", "deviceType": "siren", "deviceName": "XXXXXXX", "xCloudId": "XXXXXXX", "userRole": "OWNER", "displayOrder": 3, "mediaObjectCount": 0, "state": "provisioned", "modelId": "VMB4000-siren", "dateCreated": 1498259212117, "arloMobilePlan": false, "owner": { "firstName": "XXXXXXX ", "lastName": "XXXXXXX", "ownerId": "XXXXXXX" } }, { "userId": "XXXXXXX", "deviceId": "XXXXXXX", "parentId": "XXXXXXX", "uniqueId": "XXXXXXX", "deviceType": "camera", "deviceName": "XXXXXXX", "lastModified": XXXXXXX, "firmwareVersion": "1.092.0.19_26228", "xCloudId": "XXXXXXX", "lastImageUploaded": "true", "userRole": "OWNER", "displayOrder": 2, "presignedLastImageUrl": "https://XXXXXXX", "presignedSnapshotUrl": "https://XXXXXXX", "presignedFullFrameSnapshotUrl": "https://XXXXXXX", "mediaObjectCount": 34, "state": "provisioned", "modelId": "VMC4030", "dateCreated": 1498259342862, "arloMobilePlan": false, "interfaceVersion": "i003", "interfaceSchemaVer": "3", "owner": { "firstName": "XXXXXXX ", "lastName": "XXXXXXX", "ownerId": "XXXXXXX" }, "properties": { "modelId": "VMC4030", "olsonTimeZone": "Asia/Tokyo", "hwVersion": "H8" } }, { "userId": "XXXXXXX", "deviceId": "XXXXXXX", "parentId": "XXXXXXX", "uniqueId": "XXXXXXX", "deviceType": "camera", "deviceName": "XXXXXXX", "lastModified": XXXXXXX, "firmwareVersion": "1.092.0.19_26228", "xCloudId": "XXXXXXX", "lastImageUploaded": "true", "userRole": "OWNER", "displayOrder": 4, "presignedLastImageUrl": "https://XXXXXXX", "presignedSnapshotUrl": "https://XXXXXXX", "presignedFullFrameSnapshotUrl": "https://XXXXXXX", "mediaObjectCount": 0, "state": "provisioned", "modelId": "VMC4030", "dateCreated": 1498259411105, "arloMobilePlan": false, "interfaceVersion": "i003", "interfaceSchemaVer": "3", "owner": { "firstName": "XXXXXXX ", "lastName": "XXXXXXX", "ownerId": "XXXXXXX" }, "properties": { "modelId": "VMC4030", "olsonTimeZone": "Asia/Tokyo", "hwVersion": "H8" } } ], "success": true }
ライブラリデータの取得
リクエストcurl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: XXXXX" -d '{"dateFrom": "20181030","dateTo": "20181030"}' -X POST "https://arlo.netgear.com/hmsweb/users/library"レスポンス
{ "data": [ { "ownerId": "XXXXXXXXXXXX", "uniqueId": "XXXXXXXXXXXX", "deviceId": "XXXXXXXXXXXX", "createdDate": "20181030", "currentState": "new", "name": "1540887637213", "contentType": "video/mp4", "reason": "motionRecord", "createdBy": "XXXXXXXXXXXX", "lastModified": 1540887664644, "localCreatedDate": 1540887637213, "presignedContentUrl": "https://XXXXXXXXXXXX", "presignedThumbnailUrl": "https://XXXXXXXXXXXX", "utcCreatedDate": 1540887637213, "timeZone": "Asia/Tokyo", "mediaDuration": "00:00:17", "mediaDurationSecond": 17, "donated": false }, (snip) { "ownerId": "XXXXXXXXXXXX", "uniqueId": "XXXXXXXXXXXX", "deviceId": "XXXXXXXXXXXX", "createdDate": "20181030", "currentState": "new", "name": "1540863670652", "contentType": "video/mp4", "reason": "motionRecord", "createdBy": "XXXXXXXXXXXX", "lastModified": 1540863701929, "localCreatedDate": 1540863670652, "presignedContentUrl": "https://XXXXXXXXXXXX", "presignedThumbnailUrl": "https://XXXXXXXXXXXX", "utcCreatedDate": 1540863670652, "timeZone": "Asia/Tokyo", "mediaDuration": "00:00:15", "mediaDurationSecond": 15, "donated": false } ], "success": true }
presignedContentUrl の情報にアクセスすると動画データを取得することができる
ライブラリの簡易情報取得
リクエストcurl -H "Authorization: XXXXXXXXXXXX" -X GET "https://arlo.netgear.com/hmsweb/users/library/metadata/v2"レスポンス
{ "data": { "metaData": { "20181024": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 25 } } } }, "20181025": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 36 } } } }, "20181026": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 57 } } } }, "20181027": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 62 } } } }, "20181028": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 3 } } }, "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 20 } } } }, "20181029": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 9 } } } }, "20181030": { "xxxxxxxxxx": { "motion": { "nonFavorite": { "Other": 34 } } } } } }, "success": true }
利用料金情報の取得
リクエストcurl -H "Authorization: YOUR_TOKEN" -X GET "https://arlo.netgear.com/hmsweb/users/payment/offers"レスポンス
{ "data": [ { "id": "planId", "planId": "10137873", "planName": "Premier", "planType": "SERVICE", "numBaseStationsSupported": -1, "numCamerasSupported": 10, "numPushNotify": -1, "numSmartHomeModes": -1, "numAccounts": -1, "maxStorage": -1, "groupNumber": 1, "groupName": "Premier", "createdDate": 1520491437215, "lastModified": 1520491437215, "autoManageStorageExpiry": -1, "libraryAccessExpiry": 30, "cvrAccessExpiry": 30, "sharingExpiry": -1, "storageAutoDelete": 0, "alertStorage": 0, "alertLowBattery": -1, "scheduleExpiry": -1, "countryCode": "JP", "planMinutes": 0, "maxE911Locations": 0, "term": "1", "amount": "\0.00", "amountRaw": 0, "currency": "jpy", "planDescription": "Premier Monthly - Japan", "tieredAmount": "{}" }, (snip) { "id": "planId", "planId": "10133855", "planName": "Basic", "planType": "BASIC", "numBaseStationsSupported": -1, "numCamerasSupported": 5, "numPushNotify": -1, "numSmartHomeModes": -1, "numAccounts": -1, "maxStorage": -1, "groupNumber": 0, "groupName": "Basic", "createdDate": 1520491437215, "lastModified": 1520491437215, "autoManageStorageExpiry": -1, "libraryAccessExpiry": 7, "cvrAccessExpiry": 7, "sharingExpiry": -1, "storageAutoDelete": 0, "alertStorage": 0, "alertLowBattery": -1, "scheduleExpiry": -1, "countryCode": "JP", "planMinutes": 0, "maxE911Locations": 0, "term": "12", "amount": "\0.00", "amountRaw": 0, "currency": "jpy", "planDescription": "Basic Plan - Japan", "tieredAmount": "{}" } ], "success": true }
コメント