From ce8e8e50d2efbce2e9beb593e291dced953380af Mon Sep 17 00:00:00 2001 From: "David R. Williamson" Date: Wed, 19 Jun 2019 16:14:46 -0700 Subject: [PATCH] Add postman collection, and update IP to localhost (#189) --- rest-api-postman-collection/readme.md | 26 + .../vision-ai-devkit.postman_collection.json | 644 ++++++++++++++++++ 2 files changed, 670 insertions(+) create mode 100644 rest-api-postman-collection/readme.md create mode 100644 rest-api-postman-collection/vision-ai-devkit.postman_collection.json diff --git a/rest-api-postman-collection/readme.md b/rest-api-postman-collection/readme.md new file mode 100644 index 00000000..4843136f --- /dev/null +++ b/rest-api-postman-collection/readme.md @@ -0,0 +1,26 @@ +# Vision AI DevKit Postman Collection + +This Postman collection export exists to faciliate changing properties, running commands, and getting information via REST calls supported by the Vision AI Camera. + +To set up: + +1. Import the provided collection into Postman (version 7.2.2 or higher). +1. Open the **Manage Environments** dialog (gear icon in upper, right-hand corner). + 1. **Add** a new environment. + 1. Name the environment. + 1. Add a variable named hostIp. + 1. Add a variable named sessionId. + 1. Press the **Add** button to save. + +To use: + +1. Determine the IP address of the camera. + - Using an SSH connection, type `ifconfig wlan0`. +1. Select the environment you created earlier for this camera using the upper, right-hand corner dropdown box. +1. Select the **Environment quick look** button (eye icon in upper, right-hand corner). +1. Edit the current value of the hostIp variable, and type in the camera IP address obtained in step 1. +1. Open the Login request, and press the Send button. +1. In the response pane, press the Headers tab. +1. Find the **Set-Cookie** header, and copy the text after "session=". +1. Back in the **Environment quick look** dialog, set the current value for the sessionId variable to the value copied. +1. Run any of the other request. If any of the requests get an unauthorized error, re-run the Login request, copy the session Id, and update it in the Environment quick look dialog. diff --git a/rest-api-postman-collection/vision-ai-devkit.postman_collection.json b/rest-api-postman-collection/vision-ai-devkit.postman_collection.json new file mode 100644 index 00000000..bbb3e485 --- /dev/null +++ b/rest-api-postman-collection/vision-ai-devkit.postman_collection.json @@ -0,0 +1,644 @@ +{ + "info": { + "_postman_id": "e0f9d8b7-216b-3b49-0809-dd43b5f14052", + "name": "Peabody", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Login", + "event": [ + { + "listen": "test", + "script": { + "id": "2dd70056-8f18-40c9-bdfc-ab28f8ed260a", + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"username\": \"admin\",\n\t\"userpwd\": \"admin\"\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/login", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "login" + ] + } + }, + "response": [] + }, + { + "name": "Logout", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "value": "session={{sessionId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{hostIp}}:1080/logout", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "logout" + ] + } + }, + "response": [] + }, + { + "name": "Get preview config", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/video", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "video" + ] + } + }, + "response": [] + }, + { + "name": "Set preview config", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"resolutionSelectVal\": 0,\n\t\"encodeModeSelectVal\": 1,\n\t\"bitRateSelectVal\": 5,\n\t\"fpsSelectVal\": 1,\n\t\"displayOut\": 1\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/video", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "video" + ] + } + }, + "response": [] + }, + { + "name": "Get preview info (RTSP url)", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/preview", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "preview" + ] + } + }, + "response": [] + }, + { + "name": "Set preview on/off", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"switchStatus\": true\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/preview", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "preview" + ] + } + }, + "response": [] + }, + { + "name": "Get VA info (url)", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/vam", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "vam" + ] + } + }, + "response": [] + }, + { + "name": "Set VA on/off", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"switchStatus\": true,\n\t\"vamconfig\": \"MD\"\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/vam", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "vam" + ] + } + }, + "response": [] + }, + { + "name": "Get video overlay config", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/overlayconfig", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "overlayconfig" + ] + } + }, + "response": [] + }, + { + "name": "Set inference overlay config", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"ov_type_SelectVal\": 0,\n\t\"ov_position_SelectVal\": 0,\n\t\"ov_color\": \"0\",\n\t\"ov_usertext\": \"IOT CENTRAL\",\n\t\"ov_start_x\": 0,\n\t\"ov_start_y\": 0,\n\t\"ov_width\": 0,\n\t\"ov_height\": 0\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/overlayconfig", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "overlayconfig" + ] + } + }, + "response": [] + }, + { + "name": "Set overlay on/off", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"switchStatus\": true\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/overlay", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "overlay" + ] + } + }, + "response": [] + }, + { + "name": "Capture image (screen shot)", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{hostIp}}:1080/captureimage", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "captureimage" + ] + } + }, + "response": [] + }, + { + "name": "Set inference overlay config Copy", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"ov_type_SelectVal\": 5,\n\t\"ov_position_SelectVal\": 0,\n\t\"ov_color\": \"869007615\",\n\t\"ov_usertext\": \"Text\",\n\t\"ov_start_x\": 0,\n\t\"ov_start_y\": 0,\n\t\"ov_width\": 0,\n\t\"ov_height\": 0\n}" + }, + "url": { + "raw": "http://{{hostIp}}:1080/overlayconfig", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "overlayconfig" + ] + } + }, + "response": [] + }, + { + "name": "POST generate auth token", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"scope\": [\"admin\"]\n}\n" + }, + "url": { + "raw": "http://{{hostIp}}:9010/api/v1/auth/generate", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "9010", + "path": [ + "api", + "v1", + "auth", + "generate" + ] + } + }, + "response": [] + }, + { + "name": "POST upload file", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "value": "session={{sessionId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{hostIp}}:9010/api/v1/peabody/restart", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "9010", + "path": [ + "api", + "v1", + "peabody", + "restart" + ] + } + }, + "response": [] + }, + { + "name": "GET HDR params", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/params", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "params" + ] + } + }, + "response": [] + }, + { + "name": "POST HDR params", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/params", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "params" + ] + } + }, + "response": [] + }, + { + "name": "GET network info", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/network", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "network" + ] + } + }, + "response": [] + }, + { + "name": "POST test", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Cookie", + "type": "text", + "value": "session={{sessionId}}" + } + ], + "url": { + "raw": "http://{{hostIp}}:1080/network", + "protocol": "http", + "host": [ + "{{hostIp}}" + ], + "port": "1080", + "path": [ + "network" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file