6 Star 1 Fork 0

BestWondTim/cabinet_api_v3_code_demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Cabinet Api For Bestwond.apifox.json 123.72 KB
一键复制 编辑 原始数据 按行查看 历史
王世锋 提交于 2023-08-14 08:58 . update test device_id
{"apifoxProject":"1.0.0","$schema":{"app":"apifox","type":"project","version":"1.2.0"},"info":{"name":"Cabinet Api For Bestwond","description":"","mockRule":{}},"apiCollection":[{"name":"Root","auth":{},"parentId":0,"serverId":"","description":"","identityPattern":{"httpApi":{"type":"methodAndPath","bodyType":""}},"preProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"postProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"inheritPostProcessors":{},"inheritPreProcessors":{},"items":[{"name":"Cabinet Released Api","auth":{},"parentId":0,"serverId":"","description":"v3.0.1","identityPattern":{"httpApi":{"type":"inherit","bodyType":""}},"preProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"postProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"inheritPostProcessors":{},"inheritPreProcessors":{},"items":[{"name":"Screen display settings","api":{"id":"95785725","method":"post","path":"/api/iot/send/device/basic/info/","parameters":{"query":[{"id":"TnX8h1tb7t","name":"sign","required":true,"description":"Obtained through signature","example":"","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240318","name":"OK","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"integer","description":"0 indicates success"},"msg":{"type":"string","description":"Message"},"data":{"type":"object","properties":{"app_id":{"type":"string","description":"APP Id"},"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"integer","description":"time stamp"},"status":{"type":"string","description":"Status: success | fail"},"msg":{"type":"string","description":"ok or other info"},"sign":{"type":"string","description":"sign"}},"required":["app_id","device_number","timestamps","status","msg","sign"],"x-apifox-orders":["app_id","device_number","timestamps","status","msg","sign"],"description":"Data"}},"required":["code","msg","data"],"x-apifox-orders":["code","msg","data"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"timestamps\": 1689665135, \n \"status\": \"success\", \n \"msg\": \"ok\", \n \"sign\": \"e140aaea51549f32524543bd8fd399313ea64a1f65239876997b7e8b0f0a6e0c6232ce1ca5585bb0681bfc12e1dacdf075d30848d9bfd60e19a8d7c847b8cb8d\"\n }, \n \"des\": \"\"\n}\n","responseId":239240318,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"integer","default":10000001,"minimum":10000001,"maximum":20000001,"description":"time stamp"},"app_id":{"type":"string","description":"App Id"},"qr":{"type":"string","description":"Qr code address"},"device_address":{"type":"string","description":"Device adderss"},"app_kf_mobile":{"type":"string","description":"Help phone"}},"x-apifox-orders":["app_id","device_number","qr","device_address","app_kf_mobile","timestamps"],"required":["device_number","device_address","app_kf_mobile","timestamps","app_id","qr"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"device_address\": \"Bestwond\",\r\n \"app_kf_mobile\": \"18132641434\",\r\n \"timestamps\": 16204145,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"qr\": \"https://***.bestwond.com/devcie/2000012297\"\r\n}"},"description":"Screen display settings API:https://api.bestwond.com/api/iot/send/device/basic/info/, \nBasic settings of the screen program homepage interface, If screen app use bestwond's app, you can use this api.","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":0,"cases":[{"id":98476492,"type":"http","path":null,"name":"Success","responseId":239240318,"parameters":{"query":[{"id":"NfctG6XPLk","relatedId":"TnX8h1tb7t","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"device_address\": \"Bestwond\",\r\n \"app_kf_mobile\": \"18132641434\",\r\n \"timestamps\": 16204145,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"qr\": \"https://***.bestwond.com/devcie/2000012297\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device status","api":{"id":"95785728","method":"post","path":"/api/iot/device/line/status/","parameters":{"query":[{"id":"UvUFzsIQ1t","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240321","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 indicates success"},"data":{"description":"data","type":"object","properties":{"app_id":{"type":"string","description":"App Id"},"sign":{"type":"string","description":"sign"},"device_number":{"type":"string","description":"Device Id"},"status":{"type":"string","description":"Device status: on | off "},"timestamps":{"type":"string","description":"time stamp"}},"x-apifox-orders":["app_id","device_number","timestamps","status","sign"],"required":["app_id","sign","status","device_number","timestamps"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}}],"responseExamples":[{"name":"成功示例","data":"{\n \"code\": \"0\",\n \"data\": {\n \"app_id\": \"100001101\",\n \"sign\": \"voluptate\",\n \"status\": \"on\",\n \"timestamps\": 657415211,\n \"device_number\": \"1200010101\"\n },\n \"msg\": \"success\"\n}","responseId":239240321,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"time stamp"},"app_id":{"type":"string","description":"App Id"}},"x-apifox-orders":["app_id","device_number","timestamps"],"required":["device_number","timestamps","app_id"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}"},"description":"Get Device Status: https://api.bestwond.com/api/iot/device/line/status/","tags":[],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":18,"cases":[{"id":98476718,"type":"http","path":null,"name":"Success","responseId":239240321,"parameters":{"query":[{"id":"3HcxBM62Fm","relatedId":"UvUFzsIQ1t","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device box list","api":{"id":"95785733","method":"post","path":"/api/iot/device/box/list/","parameters":{"query":[{"id":"GrP7fzK3YB","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240326","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 indicates success"},"data":{"description":"Data","oneOf":[{"type":"object","additionalProperties":false,"properties":{"box_id":{"type":"string","description":"Box Id"},"box_name":{"type":"string","description":"Box name"},"box_status":{"type":"integer","enum":[1,2],"x-apifox":{"enumDescriptions":{"1":"Empty","2":"Full"}},"description":"Box status 1 empty 2 full"},"device_number":{"description":"Device Id","type":"string","default":"","minLength":10,"maxLength":10,"pattern":"20000[/d]{5}"},"box_size":{"type":"string","enum":["S","M","L","SX","LX"],"x-apifox":{"enumDescriptions":{"S":"Small Box","M":"Middle Box","L":"Largger Box","SX":"Ultra Small Box","LX":"Extra Large Box"}},"description":"Box size : S small , M middle, L lagger"},"lock_address":{"type":"string","description":"Box lock adderss"},"enable_status":{"type":"integer","enum":[1,2],"x-apifox":{"enumDescriptions":{"1":"Normal","2":"Disabled"}},"description":"Box disable status: 1 ok 2 disabled"},"order_no":{"type":"string","description":"Order no"}},"x-apifox-orders":["box_id","box_name","lock_address","box_size","device_number","box_status","enable_status","order_no"],"required":["box_id","box_name","box_status","device_number","box_size","lock_address","enable_status","order_no"]},{"type":"object","additionalProperties":false,"x-apifox-orders":[]}]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": [\n {\n \"box_id\": 9534, \n \"box_size\": \"L\", \n \"box_name\": \"01\", \n \"lock_address\": \"0101\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"6903244679947\", \n \"save_time\": \"2023-01-10 18:02:19\"\n }, \n {\n \"box_id\": 9535, \n \"box_size\": \"L\", \n \"box_name\": \"02\", \n \"lock_address\": \"0102\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"75893325936545\", \n \"save_time\": \"2023-01-06 14:35:19\"\n }, \n {\n \"box_id\": 9536, \n \"box_size\": \"M\", \n \"box_name\": \"03\", \n \"lock_address\": \"0103\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"S1001\", \n \"save_time\": \"2022-12-28 17:14:44\"\n }, \n {\n \"box_id\": 9537, \n \"box_size\": \"M\", \n \"box_name\": \"04\", \n \"lock_address\": \"0104\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"6971826053423\", \n \"save_time\": \"2023-01-10 18:04:54\"\n }, \n {\n \"box_id\": 9538, \n \"box_size\": \"S\", \n \"box_name\": \"05\", \n \"lock_address\": \"0105\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }, \n {\n \"box_id\": 9539, \n \"box_size\": \"S\", \n \"box_name\": \"07\", \n \"lock_address\": \"0107\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"230004\", \n \"save_time\": \"2023-01-07 10:43:53\"\n }, \n {\n \"box_id\": 9540, \n \"box_size\": \"S\", \n \"box_name\": \"06\", \n \"lock_address\": \"0106\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"213\", \n \"save_time\": \"2023-01-02 15:50:36\"\n }, \n {\n \"box_id\": 9541, \n \"box_size\": \"S\", \n \"box_name\": \"09\", \n \"lock_address\": \"0109\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }, \n {\n \"box_id\": 9542, \n \"box_size\": \"S\", \n \"box_name\": \"08\", \n \"lock_address\": \"0108\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }, \n {\n \"box_id\": 9543, \n \"box_size\": \"S\", \n \"box_name\": \"12\", \n \"lock_address\": \"010c\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"820405436255\", \n \"save_time\": \"2023-01-10 18:07:05\"\n }, \n {\n \"box_id\": 9544, \n \"box_size\": \"L\", \n \"box_name\": \"14\", \n \"lock_address\": \"010e\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"6958589624565\", \n \"save_time\": \"2023-01-10 18:01:27\"\n }, \n {\n \"box_id\": 9545, \n \"box_size\": \"S\", \n \"box_name\": \"10\", \n \"lock_address\": \"010a\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"386\", \n \"save_time\": \"2023-01-09 16:26:44\"\n }, \n {\n \"box_id\": 9546, \n \"box_size\": \"S\", \n \"box_name\": \"11\", \n \"lock_address\": \"010b\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"230001\", \n \"save_time\": \"2023-01-06 15:24:10\"\n }, \n {\n \"box_id\": 9547, \n \"box_size\": \"L\", \n \"box_name\": \"13\", \n \"lock_address\": \"010d\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }, \n {\n \"box_id\": 9548, \n \"box_size\": \"M\", \n \"box_name\": \"15\", \n \"lock_address\": \"010f\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"0091\", \n \"save_time\": \"2023-01-06 14:28:41\"\n }, \n {\n \"box_id\": 9549, \n \"box_size\": \"M\", \n \"box_name\": \"16\", \n \"lock_address\": \"0110\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"432658496698320\", \n \"save_time\": \"2023-01-06 14:33:51\"\n }, \n {\n \"box_id\": 9550, \n \"box_size\": \"S\", \n \"box_name\": \"20\", \n \"lock_address\": \"0114\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"387\", \n \"save_time\": \"2023-01-09 15:30:21\"\n }, \n {\n \"box_id\": 9551, \n \"box_size\": \"S\", \n \"box_name\": \"18\", \n \"lock_address\": \"0112\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }, \n {\n \"box_id\": 9552, \n \"box_size\": \"S\", \n \"box_name\": \"19\", \n \"lock_address\": \"0113\", \n \"device_number\": \"2000012297\", \n \"box_status\": 2, \n \"enable_status\": 1, \n \"order_no\": \"230002\", \n \"save_time\": \"2023-01-06 15:42:06\"\n }, \n {\n \"box_id\": 9553, \n \"box_size\": \"S\", \n \"box_name\": \"23\", \n \"lock_address\": \"0117\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"1201\", \n \"save_time\": \"2023-01-02 16:33:35\"\n }, \n {\n \"box_id\": 9554, \n \"box_size\": \"S\", \n \"box_name\": \"21\", \n \"lock_address\": \"0115\", \n \"device_number\": \"2000012297\", \n \"box_status\": 2, \n \"enable_status\": 1, \n \"order_no\": \"230003\", \n \"save_time\": \"2023-01-06 15:43:34\"\n }, \n {\n \"box_id\": 9555, \n \"box_size\": \"S\", \n \"box_name\": \"24\", \n \"lock_address\": \"0118\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }, \n {\n \"box_id\": 9556, \n \"box_size\": \"S\", \n \"box_name\": \"17\", \n \"lock_address\": \"0111\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"385\", \n \"save_time\": \"2023-01-09 15:48:58\"\n }, \n {\n \"box_id\": 9557, \n \"box_size\": \"S\", \n \"box_name\": \"22\", \n \"lock_address\": \"0116\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": null, \n \"save_time\": null\n }\n ], \n \"des\": \"\"\n}\n","responseId":239240326,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Time stamps"},"app_id":{"type":"string","description":"App Id"}},"x-apifox-orders":["app_id","device_number","timestamps"],"required":["device_number","timestamps","app_id"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"timestamps\": 66454255663\r\n}"},"description":"Get device box list: https://api.bestwond.com/api/iot/device/box/list/","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":48,"cases":[{"id":98477099,"type":"http","path":null,"name":"Success","responseId":239240326,"parameters":{"query":[{"id":"iNYMFoNaS0","relatedId":"GrP7fzK3YB","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"timestamps\": 66454255663\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device list","api":{"id":"95785734","method":"post","path":"/api/iot/device/list/","parameters":{"query":[{"id":"PGskrX5out","name":"sign","required":false,"description":"Obtained through signature","example":"","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240327","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"integer","description":"0 indicates success"},"msg":{"type":"string","description":"Message"},"data":{"type":"object","properties":{"page":{"type":"object","properties":{"is_first_page":{"type":"boolean"},"is_last_page":{"type":"boolean"},"page_num":{"type":"integer"},"page_size":{"type":"integer"},"tatal_page":{"type":"integer"},"tatal_count":{"type":"integer"},"page_list":{"type":"array","items":{"type":"integer"}}},"required":["is_first_page","is_last_page","page_num","page_size","tatal_page","tatal_count","page_list"],"x-apifox-orders":["is_first_page","is_last_page","page_num","page_size","tatal_page","tatal_count","page_list"]},"list":{"type":"array","items":{"type":"object","properties":{"device_number":{"type":"string"},"market_id":{"type":"integer"},"device_name":{"type":"string"},"device_address":{"type":"string"},"device_status":{"type":"integer"},"device_inline":{"type":"integer"},"nation":{"type":"string"},"province":{"type":"string"},"city":{"type":"string"},"district":{"type":"string"},"street":{"type":"string"},"longitude":{"type":"number"},"latitude":{"type":"number"},"tel":{"type":"string"},"start_servcie_time":{"type":"null"},"end_servcie_time":{"type":"null"},"uptime":{"type":"string"},"ctime":{"type":"string"}},"x-apifox-orders":["device_number","market_id","device_name","device_address","device_status","device_inline","nation","province","city","district","street","longitude","latitude","tel","start_servcie_time","end_servcie_time","uptime","ctime"]}}},"required":["page","list"],"x-apifox-orders":["page","list"],"description":"data"},"des":{"type":"string"}},"required":["code","msg","data","des"],"x-apifox-orders":["code","msg","data","des"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": [\n {\n \"device_number\": \"2100013933\", \n \"market_id\": 37, \n \"device_name\": \"2100013933\", \n \"device_address\": \"2100013933\", \n \"device_status\": 1, \n \"device_inline\": 1, \n \"nation\": \"zg\", \n \"province\": \"Henan\", \n \"city\": \"Luoyang\", \n \"district\": \"Luolong\", \n \"street\": \"Xiaowendadao\", \n \"longitude\": 112.567758, \n \"latitude\": 34.622831, \n \"tel\": \"177777777\", \n \"start_servcie_time\": \"2023-03-17 17:30:31\", \n \"end_servcie_time\": \"2024-03-17 17:30:31\", \n \"uptime\": \"2023-07-15 09:24:46\", \n \"ctime\": \"2023-03-13 15:57:34\"\n }, \n {\n \"device_number\": \"2100013075\", \n \"market_id\": 37, \n \"device_name\": \"Test2\", \n \"device_address\": \"Anzhuang\", \n \"device_status\": 1, \n \"device_inline\": 1, \n \"nation\": \"China\", \n \"province\": \"Henan\", \n \"city\": \"Luoyang\", \n \"district\": \"Luolong\", \n \"street\": \"Xiaowen\", \n \"longitude\": 112.567519, \n \"latitude\": 34.620722, \n \"tel\": \"17629726556\", \n \"start_servcie_time\": \"2022-11-01 16:42:47\", \n \"end_servcie_time\": \"2023-11-01 16:42:47\", \n \"uptime\": \"2023-07-15 09:24:46\", \n \"ctime\": \"2022-10-31 10:07:57\"\n }, \n {\n \"device_number\": \"2000012297\", \n \"market_id\": 37, \n \"device_name\": \"Test3\", \n \"device_address\": \"AnZhuang\", \n \"device_status\": 1, \n \"device_inline\": 1, \n \"nation\": \"China\", \n \"province\": \"Henan\", \n \"city\": \"Luoyang\", \n \"district\": \"Luolong\", \n \"street\": \"Fenyelu\", \n \"longitude\": 112.57092, \n \"latitude\": 34.621881, \n \"tel\": \"17638885961\", \n \"start_servcie_time\": \"2022-07-04 15:58:07\", \n \"end_servcie_time\": \"2024-04-03 15:57:47\", \n \"uptime\": \"2023-07-15 09:24:46\", \n \"ctime\": \"2022-06-30 15:58:52\"\n }\n ], \n \"des\": \"\"\n}\n","responseId":239240327,"ordering":1}],"requestBody":{"type":"application/json","parameters":[],"jsonSchema":{"type":"object","properties":{"timestamps":{"type":"integer","description":"time stamp"},"app_id":{"type":"string","description":"App Id"},"device_name":{"type":"string","description":"If parameters are passed, fuzzy queries will be performed. If parameters are not passed, no fuzzy queries will be performed"},"device_number":{"type":"string","description":"Device Id Accurate matching"}},"required":["timestamps","app_id"],"x-apifox-orders":["app_id","device_number","timestamps","device_name"]},"example":"{\r\n \"timestamps\": -12101683,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}"},"description":"Get device list : https://api.bestwond.com/api/iot/device/list/","tags":[],"status":"released","serverId":"default","operationId":"","sourceUrl":"","ordering":54,"cases":[{"id":98399323,"type":"http","path":null,"name":"Sign error","responseId":239240327,"parameters":{"path":[],"query":[{"id":"GjQD3CqeYa","relatedId":"PGskrX5out","relatedName":"sign","name":"sign","type":"string","value":"05d3b2a9717995d590920baa78a5e895653d7e29bd4cef0a0ca5dbbd83bdc7119b881cc9525781130e1b4186f7fad9eb4fd3f5d10740477abfe5df876c97f7697","enable":true,"description":"","isDelete":false}],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"timestamps\": 1669686183,\r\n \"app_id\": \"bw_db600d7a662311e\"\r\n}","type":"application/json","generateMode":"normal"},"auth":{},"advancedSettings":{},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}},{"id":98399324,"type":"http","path":null,"name":"Parameter lock","responseId":239240327,"parameters":{"path":[],"query":[{"id":"3to96sLZrh","relatedId":"PGskrX5out","relatedName":"sign","name":"sign","type":"string","value":"05d3b2a9717995d590920baa78a5e895653d7e29bd4cef0a0ca5dbbd83bdc7119b881cc9525781130e1b4186f7fad9eb4fd3f5d10740477abfe5df876c97f7697","enable":true,"description":"","isDelete":false}],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"app_id\": \"bw_db600d7a662311e\"\r\n}","type":"application/json","generateMode":"normal"},"auth":{},"advancedSettings":{},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}},{"id":98477664,"type":"http","path":null,"name":"Success","responseId":239240327,"parameters":{"query":[{"id":"VpmaffCyoI","relatedName":"sign","relatedId":"PGskrX5out","value":"","enable":true,"isDelete":false}],"header":[],"cookie":[],"path":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"timestamps\": -12101683,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","type":"application/json"},"auth":{},"advancedSettings":{},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device box log","api":{"id":"95785735","method":"post","path":"/api/iot/device/box/log/","parameters":{"query":[{"id":"PZTncy4XX4","name":"sign","required":false,"description":"Obtained through signature","example":"","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240328","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 indicates success"},"data":{"type":"object","properties":{"page":{"type":"object","properties":{},"x-apifox-orders":[]},"list":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"id"},"market_id":{"type":"string","description":"System account Id"},"app_id":{"type":"string","description":"App Id"},"device_number":{"type":"string","description":"Device Id"},"address":{"type":"string","description":"Device adderss"},"box_name":{"type":"string","description":"Box name"},"lock_addr":{"type":"string","description":"Lock adderss"},"action":{"type":"string","description":"Event"},"remark":{"type":"string","description":"Remark"},"action_time":{"type":"string","description":"action time"},"uptime":{"type":"string","description":"update time"},"ctime":{"type":"string","description":"record time"}},"x-apifox-orders":["id","market_id","app_id","device_number","address","box_name","lock_addr","action","remark","action_time","uptime","ctime"],"required":["id","market_id","remark","action","lock_addr","box_name","address","device_number","app_id","uptime","action_time","ctime"]}}},"description":"data","x-apifox-orders":["page","list"],"required":["page","list"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","msg","data"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"page\": {\n \"is_first_page\": true, \n \"is_last_page\": true, \n \"page_num\": 1, \n \"page_size\": 20, \n \"total_page\": 1, \n \"total_count\": 3, \n \"page_list\": [\n 1\n ]\n }, \n \"list\": [\n {\n \"task_id\": 129535, \n \"market_id\": 37, \n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"address\": \"AnZhuang\", \n \"box_name\": \"01\", \n \"lock_addr\": \"0101\", \n \"action\": \"1\", \n \"remark\": \"Manage backend calls success\", \n \"action_time\": \"2023-07-18 16:09:22\", \n \"uptime\": \"2023-07-18 16:09:22\", \n \"ctime\": \"2023-07-18 16:09:22\"\n }, \n {\n \"task_id\": 129533, \n \"market_id\": 37, \n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"address\": \"AnZhuang\", \n \"box_name\": \"01\", \n \"lock_addr\": \"0101\", \n \"action\": \"1\", \n \"remark\": \"Manage backend calls success\", \n \"action_time\": \"2023-07-18 16:06:59\", \n \"uptime\": \"2023-07-18 16:06:59\", \n \"ctime\": \"2023-07-18 16:06:59\"\n }, \n {\n \"task_id\": 129532, \n \"market_id\": 37, \n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"address\": \"AnZhuang\", \n \"box_name\": \"01\", \n \"lock_addr\": \"0101\", \n \"action\": \"1\", \n \"remark\": \"API calls : Device not online\", \n \"action_time\": \"2023-07-18 16:06:54\", \n \"uptime\": \"2023-07-18 16:06:54\", \n \"ctime\": \"2023-07-18 16:06:54\"\n }\n ]\n }, \n \"des\": \"\"\n}\n","responseId":239240328,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"box_name":{"type":"string","description":"Box name"},"timestamps":{"type":"integer","description":"time stamp"},"app_id":{"type":"string","description":"App Id"},"page_num":{"type":"integer","description":"page no"},"page_size":{"type":"integer","description":"page size"}},"x-apifox-orders":["app_id","device_number","box_name","timestamps","page_num","page_size"],"required":["device_number","box_name","timestamps","app_id","page_num","page_size"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"box_name\": \"01\",\r\n \"timestamps\": -3120460,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"page_num\": 1,\r\n \"page_size\": 20\r\n}"},"description":"Get device box log:https://api.bestwond.com/api/iot/device/box/log/","tags":[],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":60,"cases":[{"id":98852370,"type":"http","path":null,"name":"Success","responseId":239240328,"parameters":{"query":[{"id":"rKPCWryDsM","relatedId":"PZTncy4XX4","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"box_name\": \"01\",\r\n \"timestamps\": -3120460,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"page_num\": 1,\r\n \"page_size\": 20\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Open device box","api":{"id":"95785727","method":"post","path":"/api/iot/open/box/","parameters":{"query":[{"id":"jjUGirTEBE","name":"sign","required":true,"description":"Obtained through signature","example":"","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240320","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 indicates success"},"data":{"description":"data","type":"object","properties":{"app_id":{"type":"string","description":"APP Id"},"sign":{"type":"string","description":"sign"},"device_number":{"type":"string","description":"Device Id"},"status":{"type":"string","description":"Status: success | fail "},"timestamps":{"type":"integer","description":"time stamp"},"lock_address":{"type":"string","description":"Lock address"},"msg":{"type":"string","description":"ok or other info"}},"x-apifox-orders":["app_id","device_number","timestamps","lock_address","status","msg","sign"],"required":["app_id","sign","lock_address","device_number","status","timestamps"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}},{"id":"239256564","name":"Device offline","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{}}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"timestamps\": 1689665078, \n \"lock_address\": \"0101\", \n \"status\": \"success\", \n \"msg\": \"ok\", \n \"task_id\": 129531, \n \"sign\": \"cad522846f848c84c6f21abe15ef79d87e9c930ac6df216acc221bae662b0abc57b7bd6ac63d7e46dde41d039e9eda566b9dad30ce75ff0233a08971ef9cdc02\"\n }, \n \"des\": \"\"\n}\n","responseId":239240320,"ordering":1},{"name":"Device offline","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"timestamps\": 1689665008, \n \"lock_address\": \"0101\", \n \"status\": \"fail\", \n \"msg\": \"Device not online\", \n \"task_id\": 129530, \n \"sign\": \"0c2bcceed1035d3289030243ed3ad6e61a4aca208fdc666d8da1f0ab3032126c3b40265347f2d2eb716a15a49ba0c7546cb5ff7ab4e755c33f333b3bfcfab95e\"\n }, \n \"des\": \"\"\n}\n","responseId":239256564,"ordering":2}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"use_type":{"type":"string","description":"Usage type: S storage, G retrieval, O management door opening"},"lock_address":{"type":"string","description":"Lock address"},"timestamps":{"type":"integer","default":10000001,"minimum":10000001,"maximum":20000001,"description":"time stamp"},"app_id":{"type":"string","description":"App Id"}},"x-apifox-orders":["app_id","device_number","lock_address","use_type","timestamps"],"required":["device_number","lock_address","use_type","timestamps","app_id"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2000012297\",\r\n \"lock_address\": \"0101\",\r\n \"use_type\": \"S\",\r\n \"timestamps\": 16227727,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}"},"description":"Open Box Api: https://api.bestwond.com/api/iot/open/box/\n\ncode demo : https://gitee.com/BestWondTim/cabinet_api_v3_code_demo.git","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":12,"cases":[{"id":98476244,"type":"http","path":null,"name":"Success","responseId":239240320,"parameters":{"query":[{"id":"tZao5C6ziR","relatedId":"jjUGirTEBE","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2000012297\",\r\n \"lock_address\": \"0101\",\r\n \"use_type\": \"S\",\r\n \"timestamps\": 16227727,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[{"type":"customScript","data":"","defaultEnable":false,"enable":true,"executionTiming":"prerequest"}],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[{"name":"OpenDeviceBox.py","prompt":"","language":"python","code":"import hashlib\r\nimport requests\r\nimport json\r\nimport time\r\n\r\ndef create_sign(pay_data, mch_key):\r\n \"\"\"\r\n data sign\r\n :param mch_key:\r\n :param pay_data:\r\n :return:\r\n \"\"\"\r\n from urllib.parse import urlencode\r\n npay_data = {}\r\n for k in sorted(pay_data):\r\n npay_data[k] = pay_data[k]\r\n params = urlencode(npay_data)\r\n print(params)\r\n stringSignTemp = \"{}{}\".format(params, mch_key)\r\n print(\"stringSignTemp==\", stringSignTemp)\r\n sign = hashlib.sha512(stringSignTemp.encode('utf-8')).hexdigest()\r\n return sign\r\n\r\n# api_host = \"https://dgndev.bestwond.com\" # Develop Test Host\r\n\r\napi_host = \"https://api.bestwond.com\"\r\napp_id = \"bw_de2767d821f911e\" # Change to yours\r\napp_secret = \"de27690e21f911eda66200163e198b20\" # Change to yours\r\ndevice_number = \"2000012297\"\r\n\r\n\r\ndata = {\r\n \"device_number\": device_number,\r\n \"lock_address\": \"0101\",\r\n \"use_type\": \"S\",\r\n \"timestamps\": int(time.time()),\r\n \"app_id\": app_id\r\n}\r\nheaders = {\r\n 'Content-Type': 'application/json'\r\n }\r\nsign = create_sign(data, app_secret)\r\nres = requests.post(api_host + \"/api/iot/open/box/?sign=%s\" % sign, data=json.dumps(data), headers=headers)\r\n\r\nprint(sign)\r\nprint(res.status_code)\r\nprint(res.text)\r\nprint(res.json())"},{"name":"openbox.html","prompt":"","language":"javascript","code":"<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <title>Cabinet API JS demo</title>\r\n\r\n <script src=\"../js_code/underscore-min.js\"></script>\r\n <script src=\"../js_code/jquery-3.6.1.min.js\"></script>\r\n <script src=\"../js_code/iotauth.js\"></script>\r\n <script src=\"../js_code/openbox.js\"></script>\r\n</head>\r\n<body>\r\n<input id=\"base_url\" value=\"https://api.bestwond.com\" style=\"width: 200px;border-radius: 5px;\">\r\n<input id=\"app_id\" value=\"bw_de2767d821f911e\" style=\"width: 200px;border-radius: 5px;\">\r\n<input id=\"app_secret\" value=\"de27690e21f911eda66200163e198b20\" style=\"width: 200px;border-radius: 5px;\">\r\n<button onclick=\"kd.get_device_list()\">Get Device List</button>\r\n\r\n<div>\r\n <div id=\"device_list\" style=\"display: inline-block;width: 260px;vertical-align: top\"></div>\r\n <div id=\"device_box_list\" style=\"display: inline-block\"></div>\r\n</div>\r\n<pre id=\"api_return\"></pre>\r\n</body>\r\n</html>"},{"name":"openbox.js","prompt":"","language":"javascript","code":"var kd = {\r\n device_number: \"\",\r\n url_encode: function (str) {\r\n str = (str + '').toString();\r\n return encodeURIComponent(str)\r\n .replace(/!/g, '%21')\r\n .replace(/'/g, '%27')\r\n .replace(/\\(/g, '%28')\r\n .replace(/\\)/g, '%29')\r\n //.replace(/\\*/g, '%2A')\r\n .replace(/%20/g, '+');\r\n },\r\n create_sign: function (data) {\r\n var keys = _.sortBy(_.keys(data));\r\n var d = \"\";\r\n var that = this;\r\n var bw_key = $(\"#app_secret\").val();\r\n\r\n console.log(\"dev_key=\", bw_key);\r\n _.map(keys, function (key) {\r\n if (key == _.last(keys)) {\r\n d += key + \"=\" + that.url_encode(data[key]) + bw_key;\r\n } else {\r\n d += key + \"=\" + that.url_encode(data[key]) + \"&\"\r\n }\r\n });\r\n var sign = hex_sha512(d);\r\n console.log(d);\r\n console.log(sign);\r\n return sign;\r\n },\r\n bw_api: function (url, data) {\r\n data[\"timestamps\"] = Date.now();\r\n data[\"app_id\"] = $(\"#app_id\").val();\r\n var base_url = $(\"#base_url\").val();\r\n // console.log(\"data==\", data);\r\n var sign = this.create_sign(data);\r\n // console.log(\"sign=\", sign);\r\n var api_url = base_url + url + \"?sign=\" + sign;\r\n try {\r\n var a = $.ajax({\r\n type: \"POST\",\r\n url: api_url,\r\n data: JSON.stringify(data),\r\n \"headers\": {\r\n \"Content-Type\": \"application/json\"\r\n },\r\n async: false,\r\n dataType: \"json\",\r\n cache: false,\r\n success: function (res) {\r\n a = res;\r\n },\r\n error: function (xhr, type) {\r\n }\r\n }).responseText;\r\n return JSON.parse(a);\r\n } catch (err) {\r\n console.log('-----------11111-----------', err)\r\n return JSON.stringify({ \"code\": 10003 })\r\n }\r\n },\r\n get_device_list: function () {\r\n var url = \"/api/iot/device/list/\";\r\n var data = {};\r\n var a = kd.bw_api(url, data);\r\n this.rander_device_list(a);\r\n $(\"#api_return\").html(JSON.stringify(a));\r\n },\r\n rander_device_list: function (api_data) {\r\n var $from = $(\"#device_list\").empty();\r\n var device_list = api_data.data;\r\n _.each(device_list, function (device) {\r\n var $div_device = \"<div onclick='kd.get_device_box_list(\" + device.device_number + \")'>\" + device.device_number + \"</div>\";\r\n $from.append($div_device);\r\n });\r\n },\r\n get_device_box_list: function (dn) {\r\n var url = \"/api/iot/device/box/list/\";\r\n var data = { \"device_number\": dn };\r\n var a = kd.bw_api(url, data);\r\n this.rander_device_box_list(a);\r\n this.device_number = dn;\r\n $(\"#api_return\").html(JSON.stringify(a));\r\n },\r\n rander_device_box_list: function (api_data) {\r\n var $row = $(\"#device_box_list\").empty();\r\n var device_list = api_data.data;\r\n _.each(device_list, function (device) {\r\n var $from = $(\"<div style='padding: 2px;width: 800px;text-align: center'></div>\");\r\n var $div_device = \"<div style='display: inline-block;border:1px solid silver;width: 100px;' >\" + device.box_name + \"</div>\";\r\n $from.append($div_device);\r\n var $div_device = \"<div style='display: inline-block;border:1px solid silver;width: 100px;'>\" + device.lock_address + \"</div>\";\r\n $from.append($div_device);\r\n var $div_device = \"<div style='display: inline-block;border:1px solid silver;width: 100px;'>\" + device.box_status + \"</div>\";\r\n $from.append($div_device);\r\n var $div_device = \"<div style='display: inline-block;border:1px solid silver;width: 100px;'>\" + device.enable_status + \"</div>\";\r\n $from.append($div_device);\r\n var $div_device = \"<div style='display: inline-block;border:1px solid silver;width: 100px;'>\" + device.box_size + \"</div>\";\r\n $from.append($div_device);\r\n var $div_device = \"<div style='display: inline-block;border:1px solid silver;width: 100px;'><button onclick='kd.open_box(\\\"\" + device.lock_address + \"\\\")'>Open Box</button></div>\";\r\n $from.append($div_device);\r\n $row.append($from);\r\n });\r\n },\r\n open_box: function (lock_address) {\r\n console.log(\"------------lock_address=\", lock_address);\r\n var url = \"/api/iot/open/box/\";\r\n var data = {\r\n \"device_number\": this.device_number,\r\n \"lock_address\": lock_address,\r\n \"use_type\": \"S\"\r\n };\r\n var a = kd.bw_api(url, data);\r\n $(\"#api_return\").html(JSON.stringify(a));\r\n }\r\n}"},{"name":"iotauth.js","prompt":"","language":"javascript","code":"/*\r\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined\r\n * in FIPS 180-2\r\n * Version 2.2 Copyright Anonymous Contributor, Paul Johnston 2000 - 2009.\r\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\r\n * Distributed under the BSD License\r\n * See http://pajhome.org.uk/crypt/md5 for details.\r\n */\r\n\r\n/*\r\n * Configurable variables. You may need to tweak these to be compatible with\r\n * the server-side, but the defaults work in most cases.\r\n */\r\nvar hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */\r\nvar b64pad = \"\"; /* base-64 pad character. \"=\" for strict RFC compliance */\r\n\r\n/*\r\n * These are the functions you'll usually want to call\r\n * They take string arguments and return either hex or base-64 encoded strings\r\n */\r\nfunction hex_sha512(s) { return rstr2hex(rstr_sha512(str2rstr_utf8(s))); }\r\nfunction b64_sha512(s) { return rstr2b64(rstr_sha512(str2rstr_utf8(s))); }\r\nfunction any_sha512(s, e) { return rstr2any(rstr_sha512(str2rstr_utf8(s)), e);}\r\nfunction hex_hmac_sha512(k, d)\r\n { return rstr2hex(rstr_hmac_sha512(str2rstr_utf8(k), str2rstr_utf8(d))); }\r\nfunction b64_hmac_sha512(k, d)\r\n { return rstr2b64(rstr_hmac_sha512(str2rstr_utf8(k), str2rstr_utf8(d))); }\r\nfunction any_hmac_sha512(k, d, e)\r\n { return rstr2any(rstr_hmac_sha512(str2rstr_utf8(k), str2rstr_utf8(d)), e);}\r\n\r\n/*\r\n * Perform a simple self-test to see if the VM is working\r\n */\r\nfunction sha512_vm_test()\r\n{\r\n return hex_sha512(\"abc\").toLowerCase() ==\r\n \"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a\" +\r\n \"2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f\";\r\n}\r\n\r\n/*\r\n * Calculate the SHA-512 of a raw string\r\n */\r\nfunction rstr_sha512(s)\r\n{\r\n return binb2rstr(binb_sha512(rstr2binb(s), s.length * 8));\r\n}\r\n\r\n/*\r\n * Calculate the HMAC-SHA-512 of a key and some data (raw strings)\r\n */\r\nfunction rstr_hmac_sha512(key, data)\r\n{\r\n var bkey = rstr2binb(key);\r\n if(bkey.length > 32) bkey = binb_sha512(bkey, key.length * 8);\r\n\r\n var ipad = Array(32), opad = Array(32);\r\n for(var i = 0; i < 32; i++)\r\n {\r\n ipad[i] = bkey[i] ^ 0x36363636;\r\n opad[i] = bkey[i] ^ 0x5C5C5C5C;\r\n }\r\n\r\n var hash = binb_sha512(ipad.concat(rstr2binb(data)), 1024 + data.length * 8);\r\n return binb2rstr(binb_sha512(opad.concat(hash), 1024 + 512));\r\n}\r\n\r\n/*\r\n * Convert a raw string to a hex string\r\n */\r\nfunction rstr2hex(input)\r\n{\r\n try { hexcase } catch(e) { hexcase=0; }\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var output = \"\";\r\n var x;\r\n for(var i = 0; i < input.length; i++)\r\n {\r\n x = input.charCodeAt(i);\r\n output += hex_tab.charAt((x >>> 4) & 0x0F)\r\n + hex_tab.charAt( x & 0x0F);\r\n }\r\n return output;\r\n}\r\n\r\n/*\r\n * Convert a raw string to a base-64 string\r\n */\r\nfunction rstr2b64(input)\r\n{\r\n try { b64pad } catch(e) { b64pad=''; }\r\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n var output = \"\";\r\n var len = input.length;\r\n for(var i = 0; i < len; i += 3)\r\n {\r\n var triplet = (input.charCodeAt(i) << 16)\r\n | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)\r\n | (i + 2 < len ? input.charCodeAt(i+2) : 0);\r\n for(var j = 0; j < 4; j++)\r\n {\r\n if(i * 8 + j * 6 > input.length * 8) output += b64pad;\r\n else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);\r\n }\r\n }\r\n return output;\r\n}\r\n\r\n/*\r\n * Convert a raw string to an arbitrary string encoding\r\n */\r\nfunction rstr2any(input, encoding)\r\n{\r\n var divisor = encoding.length;\r\n var i, j, q, x, quotient;\r\n\r\n /* Convert to an array of 16-bit big-endian values, forming the dividend */\r\n var dividend = Array(Math.ceil(input.length / 2));\r\n for(i = 0; i < dividend.length; i++)\r\n {\r\n dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);\r\n }\r\n\r\n /*\r\n * Repeatedly perform a long division. The binary array forms the dividend,\r\n * the length of the encoding is the divisor. Once computed, the quotient\r\n * forms the dividend for the next step. All remainders are stored for later\r\n * use.\r\n */\r\n var full_length = Math.ceil(input.length * 8 /\r\n (Math.log(encoding.length) / Math.log(2)));\r\n var remainders = Array(full_length);\r\n for(j = 0; j < full_length; j++)\r\n {\r\n quotient = Array();\r\n x = 0;\r\n for(i = 0; i < dividend.length; i++)\r\n {\r\n x = (x << 16) + dividend[i];\r\n q = Math.floor(x / divisor);\r\n x -= q * divisor;\r\n if(quotient.length > 0 || q > 0)\r\n quotient[quotient.length] = q;\r\n }\r\n remainders[j] = x;\r\n dividend = quotient;\r\n }\r\n\r\n /* Convert the remainders to the output string */\r\n var output = \"\";\r\n for(i = remainders.length - 1; i >= 0; i--)\r\n output += encoding.charAt(remainders[i]);\r\n\r\n return output;\r\n}\r\n\r\n/*\r\n * Encode a string as utf-8.\r\n * For efficiency, this assumes the input is valid utf-16.\r\n */\r\nfunction str2rstr_utf8(input)\r\n{\r\n var output = \"\";\r\n var i = -1;\r\n var x, y;\r\n\r\n while(++i < input.length)\r\n {\r\n /* Decode utf-16 surrogate pairs */\r\n x = input.charCodeAt(i);\r\n y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;\r\n if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)\r\n {\r\n x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);\r\n i++;\r\n }\r\n\r\n /* Encode output as utf-8 */\r\n if(x <= 0x7F)\r\n output += String.fromCharCode(x);\r\n else if(x <= 0x7FF)\r\n output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),\r\n 0x80 | ( x & 0x3F));\r\n else if(x <= 0xFFFF)\r\n output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),\r\n 0x80 | ((x >>> 6 ) & 0x3F),\r\n 0x80 | ( x & 0x3F));\r\n else if(x <= 0x1FFFFF)\r\n output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),\r\n 0x80 | ((x >>> 12) & 0x3F),\r\n 0x80 | ((x >>> 6 ) & 0x3F),\r\n 0x80 | ( x & 0x3F));\r\n }\r\n return output;\r\n}\r\n\r\n/*\r\n * Encode a string as utf-16\r\n */\r\nfunction str2rstr_utf16le(input)\r\n{\r\n var output = \"\";\r\n for(var i = 0; i < input.length; i++)\r\n output += String.fromCharCode( input.charCodeAt(i) & 0xFF,\r\n (input.charCodeAt(i) >>> 8) & 0xFF);\r\n return output;\r\n}\r\n\r\nfunction str2rstr_utf16be(input)\r\n{\r\n var output = \"\";\r\n for(var i = 0; i < input.length; i++)\r\n output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,\r\n input.charCodeAt(i) & 0xFF);\r\n return output;\r\n}\r\n\r\n/*\r\n * Convert a raw string to an array of big-endian words\r\n * Characters >255 have their high-byte silently ignored.\r\n */\r\nfunction rstr2binb(input)\r\n{\r\n var output = Array(input.length >> 2);\r\n for(var i = 0; i < output.length; i++)\r\n output[i] = 0;\r\n for(var i = 0; i < input.length * 8; i += 8)\r\n output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);\r\n return output;\r\n}\r\n\r\n/*\r\n * Convert an array of big-endian words to a string\r\n */\r\nfunction binb2rstr(input)\r\n{\r\n var output = \"\";\r\n for(var i = 0; i < input.length * 32; i += 8)\r\n output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);\r\n return output;\r\n}\r\n\r\n/*\r\n * Calculate the SHA-512 of an array of big-endian dwords, and a bit length\r\n */\r\nvar sha512_k;\r\nfunction binb_sha512(x, len)\r\n{\r\n if(sha512_k == undefined)\r\n {\r\n //SHA512 constants\r\n sha512_k = new Array(\r\nnew int64(0x428a2f98, -685199838), new int64(0x71374491, 0x23ef65cd),\r\nnew int64(-1245643825, -330482897), new int64(-373957723, -2121671748),\r\nnew int64(0x3956c25b, -213338824), new int64(0x59f111f1, -1241133031),\r\nnew int64(-1841331548, -1357295717), new int64(-1424204075, -630357736),\r\nnew int64(-670586216, -1560083902), new int64(0x12835b01, 0x45706fbe),\r\nnew int64(0x243185be, 0x4ee4b28c), new int64(0x550c7dc3, -704662302),\r\nnew int64(0x72be5d74, -226784913), new int64(-2132889090, 0x3b1696b1),\r\nnew int64(-1680079193, 0x25c71235), new int64(-1046744716, -815192428),\r\nnew int64(-459576895, -1628353838), new int64(-272742522, 0x384f25e3),\r\nnew int64(0xfc19dc6, -1953704523), new int64(0x240ca1cc, 0x77ac9c65),\r\nnew int64(0x2de92c6f, 0x592b0275), new int64(0x4a7484aa, 0x6ea6e483),\r\nnew int64(0x5cb0a9dc, -1119749164), new int64(0x76f988da, -2096016459),\r\nnew int64(-1740746414, -295247957), new int64(-1473132947, 0x2db43210),\r\nnew int64(-1341970488, -1728372417), new int64(-1084653625, -1091629340),\r\nnew int64(-958395405, 0x3da88fc2), new int64(-710438585, -1828018395),\r\nnew int64(0x6ca6351, -536640913), new int64(0x14292967, 0xa0e6e70),\r\nnew int64(0x27b70a85, 0x46d22ffc), new int64(0x2e1b2138, 0x5c26c926),\r\nnew int64(0x4d2c6dfc, 0x5ac42aed), new int64(0x53380d13, -1651133473),\r\nnew int64(0x650a7354, -1951439906), new int64(0x766a0abb, 0x3c77b2a8),\r\nnew int64(-2117940946, 0x47edaee6), new int64(-1838011259, 0x1482353b),\r\nnew int64(-1564481375, 0x4cf10364), new int64(-1474664885, -1136513023),\r\nnew int64(-1035236496, -789014639), new int64(-949202525, 0x654be30),\r\nnew int64(-778901479, -688958952), new int64(-694614492, 0x5565a910),\r\nnew int64(-200395387, 0x5771202a), new int64(0x106aa070, 0x32bbd1b8),\r\nnew int64(0x19a4c116, -1194143544), new int64(0x1e376c08, 0x5141ab53),\r\nnew int64(0x2748774c, -544281703), new int64(0x34b0bcb5, -509917016),\r\nnew int64(0x391c0cb3, -976659869), new int64(0x4ed8aa4a, -482243893),\r\nnew int64(0x5b9cca4f, 0x7763e373), new int64(0x682e6ff3, -692930397),\r\nnew int64(0x748f82ee, 0x5defb2fc), new int64(0x78a5636f, 0x43172f60),\r\nnew int64(-2067236844, -1578062990), new int64(-1933114872, 0x1a6439ec),\r\nnew int64(-1866530822, 0x23631e28), new int64(-1538233109, -561857047),\r\nnew int64(-1090935817, -1295615723), new int64(-965641998, -479046869),\r\nnew int64(-903397682, -366583396), new int64(-779700025, 0x21c0c207),\r\nnew int64(-354779690, -840897762), new int64(-176337025, -294727304),\r\nnew int64(0x6f067aa, 0x72176fba), new int64(0xa637dc5, -1563912026),\r\nnew int64(0x113f9804, -1090974290), new int64(0x1b710b35, 0x131c471b),\r\nnew int64(0x28db77f5, 0x23047d84), new int64(0x32caab7b, 0x40c72493),\r\nnew int64(0x3c9ebe0a, 0x15c9bebc), new int64(0x431d67c4, -1676669620),\r\nnew int64(0x4cc5d4be, -885112138), new int64(0x597f299c, -60457430),\r\nnew int64(0x5fcb6fab, 0x3ad6faec), new int64(0x6c44198c, 0x4a475817));\r\n }\r\n\r\n //Initial hash values\r\n var H = new Array(\r\nnew int64(0x6a09e667, -205731576),\r\nnew int64(-1150833019, -2067093701),\r\nnew int64(0x3c6ef372, -23791573),\r\nnew int64(-1521486534, 0x5f1d36f1),\r\nnew int64(0x510e527f, -1377402159),\r\nnew int64(-1694144372, 0x2b3e6c1f),\r\nnew int64(0x1f83d9ab, -79577749),\r\nnew int64(0x5be0cd19, 0x137e2179));\r\n\r\n var T1 = new int64(0, 0),\r\n T2 = new int64(0, 0),\r\n a = new int64(0,0),\r\n b = new int64(0,0),\r\n c = new int64(0,0),\r\n d = new int64(0,0),\r\n e = new int64(0,0),\r\n f = new int64(0,0),\r\n g = new int64(0,0),\r\n h = new int64(0,0),\r\n //Temporary variables not specified by the document\r\n s0 = new int64(0, 0),\r\n s1 = new int64(0, 0),\r\n Ch = new int64(0, 0),\r\n Maj = new int64(0, 0),\r\n r1 = new int64(0, 0),\r\n r2 = new int64(0, 0),\r\n r3 = new int64(0, 0);\r\n var j, i;\r\n var W = new Array(80);\r\n for(i=0; i<80; i++)\r\n W[i] = new int64(0, 0);\r\n\r\n // append padding to the source string. The format is described in the FIPS.\r\n x[len >> 5] |= 0x80 << (24 - (len & 0x1f));\r\n x[((len + 128 >> 10)<< 5) + 31] = len;\r\n\r\n for(i = 0; i<x.length; i+=32) //32 dwords is the block size\r\n {\r\n int64copy(a, H[0]);\r\n int64copy(b, H[1]);\r\n int64copy(c, H[2]);\r\n int64copy(d, H[3]);\r\n int64copy(e, H[4]);\r\n int64copy(f, H[5]);\r\n int64copy(g, H[6]);\r\n int64copy(h, H[7]);\r\n\r\n for(j=0; j<16; j++)\r\n {\r\n W[j].h = x[i + 2*j];\r\n W[j].l = x[i + 2*j + 1];\r\n }\r\n\r\n for(j=16; j<80; j++)\r\n {\r\n //sigma1\r\n int64rrot(r1, W[j-2], 19);\r\n int64revrrot(r2, W[j-2], 29);\r\n int64shr(r3, W[j-2], 6);\r\n s1.l = r1.l ^ r2.l ^ r3.l;\r\n s1.h = r1.h ^ r2.h ^ r3.h;\r\n //sigma0\r\n int64rrot(r1, W[j-15], 1);\r\n int64rrot(r2, W[j-15], 8);\r\n int64shr(r3, W[j-15], 7);\r\n s0.l = r1.l ^ r2.l ^ r3.l;\r\n s0.h = r1.h ^ r2.h ^ r3.h;\r\n\r\n int64add4(W[j], s1, W[j-7], s0, W[j-16]);\r\n }\r\n\r\n for(j = 0; j < 80; j++)\r\n {\r\n //Ch\r\n Ch.l = (e.l & f.l) ^ (~e.l & g.l);\r\n Ch.h = (e.h & f.h) ^ (~e.h & g.h);\r\n\r\n //Sigma1\r\n int64rrot(r1, e, 14);\r\n int64rrot(r2, e, 18);\r\n int64revrrot(r3, e, 9);\r\n s1.l = r1.l ^ r2.l ^ r3.l;\r\n s1.h = r1.h ^ r2.h ^ r3.h;\r\n\r\n //Sigma0\r\n int64rrot(r1, a, 28);\r\n int64revrrot(r2, a, 2);\r\n int64revrrot(r3, a, 7);\r\n s0.l = r1.l ^ r2.l ^ r3.l;\r\n s0.h = r1.h ^ r2.h ^ r3.h;\r\n\r\n //Maj\r\n Maj.l = (a.l & b.l) ^ (a.l & c.l) ^ (b.l & c.l);\r\n Maj.h = (a.h & b.h) ^ (a.h & c.h) ^ (b.h & c.h);\r\n\r\n int64add5(T1, h, s1, Ch, sha512_k[j], W[j]);\r\n int64add(T2, s0, Maj);\r\n\r\n int64copy(h, g);\r\n int64copy(g, f);\r\n int64copy(f, e);\r\n int64add(e, d, T1);\r\n int64copy(d, c);\r\n int64copy(c, b);\r\n int64copy(b, a);\r\n int64add(a, T1, T2);\r\n }\r\n int64add(H[0], H[0], a);\r\n int64add(H[1], H[1], b);\r\n int64add(H[2], H[2], c);\r\n int64add(H[3], H[3], d);\r\n int64add(H[4], H[4], e);\r\n int64add(H[5], H[5], f);\r\n int64add(H[6], H[6], g);\r\n int64add(H[7], H[7], h);\r\n }\r\n\r\n //represent the hash as an array of 32-bit dwords\r\n var hash = new Array(16);\r\n for(i=0; i<8; i++)\r\n {\r\n hash[2*i] = H[i].h;\r\n hash[2*i + 1] = H[i].l;\r\n }\r\n return hash;\r\n}\r\n\r\n//A constructor for 64-bit numbers\r\nfunction int64(h, l)\r\n{\r\n this.h = h;\r\n this.l = l;\r\n //this.toString = int64toString;\r\n}\r\n\r\n//Copies src into dst, assuming both are 64-bit numbers\r\nfunction int64copy(dst, src)\r\n{\r\n dst.h = src.h;\r\n dst.l = src.l;\r\n}\r\n\r\n//Right-rotates a 64-bit number by shift\r\n//Won't handle cases of shift>=32\r\n//The function revrrot() is for that\r\nfunction int64rrot(dst, x, shift)\r\n{\r\n dst.l = (x.l >>> shift) | (x.h << (32-shift));\r\n dst.h = (x.h >>> shift) | (x.l << (32-shift));\r\n}\r\n\r\n//Reverses the dwords of the source and then rotates right by shift.\r\n//This is equivalent to rotation by 32+shift\r\nfunction int64revrrot(dst, x, shift)\r\n{\r\n dst.l = (x.h >>> shift) | (x.l << (32-shift));\r\n dst.h = (x.l >>> shift) | (x.h << (32-shift));\r\n}\r\n\r\n//Bitwise-shifts right a 64-bit number by shift\r\n//Won't handle shift>=32, but it's never needed in SHA512\r\nfunction int64shr(dst, x, shift)\r\n{\r\n dst.l = (x.l >>> shift) | (x.h << (32-shift));\r\n dst.h = (x.h >>> shift);\r\n}\r\n\r\n//Adds two 64-bit numbers\r\n//Like the original implementation, does not rely on 32-bit operations\r\nfunction int64add(dst, x, y)\r\n{\r\n var w0 = (x.l & 0xffff) + (y.l & 0xffff);\r\n var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16);\r\n var w2 = (x.h & 0xffff) + (y.h & 0xffff) + (w1 >>> 16);\r\n var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16);\r\n dst.l = (w0 & 0xffff) | (w1 << 16);\r\n dst.h = (w2 & 0xffff) | (w3 << 16);\r\n}\r\n\r\n//Same, except with 4 addends. Works faster than adding them one by one.\r\nfunction int64add4(dst, a, b, c, d)\r\n{\r\n var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff);\r\n var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16);\r\n var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (w1 >>> 16);\r\n var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16);\r\n dst.l = (w0 & 0xffff) | (w1 << 16);\r\n dst.h = (w2 & 0xffff) | (w3 << 16);\r\n}\r\n\r\n//Same, except with 5 addends\r\nfunction int64add5(dst, a, b, c, d, e)\r\n{\r\n var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff) + (e.l & 0xffff);\r\n var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (e.l >>> 16) + (w0 >>> 16);\r\n var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (e.h & 0xffff) + (w1 >>> 16);\r\n var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (e.h >>> 16) + (w2 >>> 16);\r\n dst.l = (w0 & 0xffff) | (w1 << 16);\r\n dst.h = (w2 & 0xffff) | (w3 << 16);\r\n}\r\n\r\n"},{"name":"OpenDeviceBox.php","prompt":"","language":"php","code":"<?php\r\n$secret = 'de27690e21f911e**********e198b20'; // Signature Secret\r\n$app_id = 'bw_de27*******11e';\r\n$fields = array( 'app_id' => $app_id,\r\n 'device_number' => '200****001',\r\n\t\t\t\t'lock_address' => '0101',\r\n\t\t\t\t'use_type' => 'S',\r\n\t\t\t\t'timestamps' => time());\r\nksort($fields);\r\necho $fields;\r\n$sign = hash('SHA512', http_build_query($fields) . $secret);\r\necho http_build_query($fields) . $secret;\r\necho '-----------iot openbox create sign--------------\\n';\r\necho $sign;\r\necho '-----------iot openbox api test--------------\\n';\r\necho http_build_query($fields);\r\n$curl = curl_init();\r\necho '-----------iot openbox teststart--------------\\n';\r\ncurl_setopt_array($curl, array(\r\n CURLOPT_URL => 'https://dgndev.bestwond.com/api/iot/open/box/?sign='.$sign,\r\n CURLOPT_RETURNTRANSFER => true,\r\n CURLOPT_ENCODING => '',\r\n CURLOPT_MAXREDIRS => 10,\r\n CURLOPT_TIMEOUT => 0,\r\n CURLOPT_FOLLOWLOCATION => true,\r\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\r\n CURLOPT_CUSTOMREQUEST => 'POST',\r\n CURLOPT_POSTFIELDS =>json_encode($fields),\r\n CURLOPT_HTTPHEADER => array(\r\n 'Content-Type: application/json',\r\n ),\r\n));\r\necho '-----------$curl--------------\\n';\r\necho $curl;\r\n$response = curl_exec($curl);\r\n\r\ncurl_close($curl);\r\necho $response;\r\necho '----------$response-------------\\n';\r\n?>"},{"name":"OpenBoxDemo.java","prompt":"","language":"java","code":"package com.bestwond.test;\r\n\r\nimport java.io.ByteArrayOutputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.io.OutputStream;\r\nimport java.net.HttpURLConnection;\r\nimport java.net.URL;\r\nimport java.nio.charset.StandardCharsets;\r\nimport java.security.MessageDigest;\r\nimport java.security.NoSuchAlgorithmException;\r\nimport java.util.HashMap;\r\nimport java.util.Iterator;\r\nimport java.util.Map;\r\nimport java.util.TreeMap;\r\n\r\npublic class OpenBoxDemo {\r\n\r\n public static String getPost(String url, Map<String, String> heads,\r\n Map<String, String> params) throws IOException {\r\n\r\n URL u;\r\n HttpURLConnection connection = null;\r\n OutputStream out;\r\n try {\r\n u = new URL(url);\r\n connection = (HttpURLConnection) u.openConnection();\r\n connection.setRequestMethod(\"POST\");\r\n connection.setConnectTimeout(30000);\r\n connection.setReadTimeout(30000);\r\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\r\n connection.setDoOutput(true);\r\n connection.setDoInput(true);\r\n if (heads != null) {\r\n for (Map.Entry<String, String> stringStringEntry : heads.entrySet()) {\r\n connection.setRequestProperty(stringStringEntry.getKey(),\r\n stringStringEntry.getValue());\r\n }\r\n }\r\n\r\n out = connection.getOutputStream();\r\n if (params != null && !params.isEmpty()) {\r\n out.write(toJSONString(params).getBytes());\r\n }\r\n out.flush();\r\n out.close();\r\n\r\n InputStream is = connection.getInputStream();\r\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\r\n int i;\r\n while ((i = is.read()) != -1) {\r\n baos.write(i);\r\n }\r\n return baos.toString();\r\n\r\n } catch (Exception e) {\r\n throw e;\r\n }\r\n }\r\n\r\n public static String toJSONString(Map<String, String> map) {\r\n Iterator<Map.Entry<String, String>> i = map.entrySet().iterator();\r\n if (!i.hasNext()) {\r\n return \"{}\";\r\n }\r\n StringBuilder sb = new StringBuilder();\r\n sb.append('{');\r\n for (; ; ) {\r\n\r\n Map.Entry<String, String> e = i.next();\r\n String key = e.getKey();\r\n String value = e.getValue();\r\n sb.append(\"\\\"\");\r\n sb.append(key);\r\n sb.append(\"\\\"\");\r\n sb.append(':');\r\n sb.append(\"\\\"\");\r\n sb.append(value);\r\n sb.append(\"\\\"\");\r\n if (!i.hasNext()) {\r\n return sb.append('}').toString();\r\n }\r\n sb.append(',').append(' ');\r\n }\r\n }\r\n\r\n public static String create_sign(String params, String app_secret) {\r\n params = params + app_secret;\r\n byte[] bytes = params.getBytes(StandardCharsets.UTF_8);\r\n MessageDigest messageDigest;\r\n try {\r\n messageDigest = MessageDigest.getInstance(\"SHA-512\");\r\n messageDigest.update(bytes);\r\n } catch (NoSuchAlgorithmException e) {\r\n throw new RuntimeException(\"SHA sign error\");\r\n }\r\n byte[] digest = messageDigest.digest();\r\n return byteArrayToHexString(digest);\r\n }\r\n\r\n private static String byteArrayToHexString(byte[] bytes) {\r\n StringBuilder builder = new StringBuilder();\r\n for (byte b : bytes) {\r\n String temp = Integer.toHexString(b & 0xFF);\r\n if (temp.length() == 1) {\r\n builder.append(\"0\");\r\n }\r\n builder.append(temp);\r\n }\r\n return builder.toString();\r\n }\r\n\r\n\r\n public static void main(String[] args) throws IOException {\r\n Map<String,String> map =new TreeMap<>((k1, k2)->{\r\n return k1.compareTo(k2);\r\n });\r\n\r\n map.put(\"app_id\", \"bw_de27*******11e\");\r\n map.put(\"timestamps\", String.valueOf(System.currentTimeMillis()/1000));\r\n map.put(\"device_number\", \"200****001\");\r\n map.put(\"lock_address\", \"0101\");\r\n map.put(\"use_type\", \"S\");\r\n\r\n StringBuilder sb = new StringBuilder();\r\n for (Map.Entry<String, String> entry : map.entrySet()) {\r\n sb.append(entry.getKey() + \"=\" + entry.getValue() + \"&\");\r\n }\r\n String params = sb.toString();\r\n if (sb.length() > 0) {\r\n params = sb.substring(0, sb.length()-1);\r\n }\r\n String sign = create_sign(params, \"de27690e21f911e**********e198b20\");\r\n map.put(\"sign\", sign);\r\n Map<String,String> headers = new HashMap<>();\r\n\r\n String result = getPost(\"https://api.bestwond.com/api/iot/open/box/?sign=\"+sign, headers, map);\r\n System.out.println(result);\r\n }\r\n}\r\n"},{"name":"Open Box Demo","prompt":"","language":"go","code":"package main\r\n\r\nimport (\r\n\t\"crypto/sha512\"\r\n\t\"encoding/hex\"\r\n\t\"fmt\"\r\n\t\"io/ioutil\"\r\n\t\"net/http\"\r\n\t\"net/url\"\r\n\t\"strings\"\r\n)\r\n\r\n//sha512 sign\r\nfunc sha512Str(src string) string {\r\n\th := sha512.New()\r\n\th.Write([]byte(src)) //\r\n\t//fmt.Printf(\"%s\\n\", hex.EncodeToString(h.Sum(nil))) // print sign out\r\n\treturn hex.EncodeToString(h.Sum(nil))\r\n}\r\n\r\nfunc main() {\r\n\r\n\turl2 := \"https://api.bestwond.com/api/iot/open/box/?sign=\"\r\n\tmethod := \"POST\"\r\n\tapp_secret := \"de27690e21f911eda66200163e198b20\"\r\n\r\n\tpayload := strings.NewReader(`{\r\n \"device_number\": \"2000012297\",\r\n \"lock_address\": \"0101\",\r\n \"use_type\": \"S\",\r\n \"timestamps\": 16227727,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n }`)\r\n\r\n\tparams := url.Values{}\r\n\tparams.Add(\"device_number\", \"2000012297\")\r\n\tparams.Add(\"lock_address\", \"0101\")\r\n\tparams.Add(\"use_type\", \"S\")\r\n\tparams.Add(\"timestamps\", \"16227727\")\r\n\tparams.Add(\"app_id\", \"bw_de2767d821f911e\")\r\n\r\n\tfmt.Println(params.Encode() + app_secret)\r\n\r\n\tenstr := params.Encode() + app_secret\r\n\tsign := sha512Str(enstr)\r\n\turl3 := url2 + sign\r\n fmt.Println(sign)\r\n\tfmt.Println(url3)\r\n\r\n\tclient := &http.Client{}\r\n\treq, err := http.NewRequest(method, url3, payload)\r\n\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t\treturn\r\n\t}\r\n\treq.Header.Add(\"Content-Type\", \"application/json\")\r\n\r\n\tres, err := client.Do(req)\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t\treturn\r\n\t}\r\n\tdefer res.Body.Close()\r\n\r\n\tbody, err := ioutil.ReadAll(res.Body)\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t\treturn\r\n\t}\r\n\tfmt.Println(string(body))\r\n}\r\n"}],"commonResponseStatus":{"240538742":false},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}}]},{"name":"How to Get Box Door Status","auth":{},"parentId":0,"serverId":"","description":"","identityPattern":{"httpApi":{"type":"inherit","bodyType":"","fields":[]}},"preProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"postProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"inheritPostProcessors":{},"inheritPreProcessors":{},"items":[{"name":"Get device box door open status","api":{"id":"95785729","method":"post","path":"/api/iot/device/box/status/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240322","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":" 0 Indicates successful API call"},"data":{"description":"Data","type":"object","properties":{"app_id":{"type":"string","description":"App Id"},"sign":{"type":"string","description":"sign"},"device_number":{"type":"string","description":"Device Id"},"status":{"type":"string","description":"0 indicates successful sending to the device"},"timestamps":{"type":"string","description":"Time stamp"},"lock_address":{"type":"string","description":"Lock Address"}},"x-apifox-orders":["app_id","device_number","lock_address","timestamps","status","sign"],"required":["app_id","sign","status","device_number","timestamps","lock_address"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"lock_address\": \"0101\", \n \"timestamps\": 1689761584, \n \"status\": \"success\", \n \"msg\": \"ok\", \n \"sign\": \"9322091469e08c5120d51bf6c6120844fa52a31fed522b56a57a9f6da331ee3b3eead343f9cbd28702d2c4c7e6695da525de0777e00b9414c057927492962418\"\n }, \n \"des\": \"\"\n}\n","responseId":0,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"lock_address":{"type":"string","description":"Lock Address"}},"x-apifox-orders":["app_id","device_number","timestamps","lock_address"],"required":["device_number","timestamps","app_id","lock_address"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"lock_address\": \"0101\"\r\n}"},"description":"Send device info for get box door open or close status : https://api.bestwond.com/api/iot/device/box/status/","tags":[],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":24,"cases":[{"id":98477078,"type":"http","path":null,"name":"Success","responseId":239240322,"parameters":{"query":[{"id":"fwn2tRmbjL","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"lock_address\": \"0101\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Set api for get box door open status","api":{"id":"95785732","method":"post","path":"/api/iot/device/set/box/callback/address/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240325","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 Indicates successful API call"},"data":{"description":"Data","type":"object","properties":{"app_id":{"type":"string","description":"App Id"},"sign":{"type":"string","description":"sign"},"device_number":{"type":"string","description":"Device Id"},"status":{"type":"string","description":"0 indicates successful sending to the device"},"timestamps":{"type":"string","description":"Time stamp"},"call_ad":{"type":"string","description":"Notification API Address"}},"x-apifox-orders":["app_id","device_number","call_ad","timestamps","status","sign"],"required":["app_id","sign","status","device_number","timestamps","call_ad"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}}],"responseExamples":[{"name":"成功示例","data":"{\n \"code\": 0,\n \"msg\": \"操作成功\",\n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\",\n \"device_number\": \"2000012297\",\n \"call_ad\": \"httpps://***\",\n \"timestamps\": 1688787319,\n \"status\": \"success\",\n \"msg\": \"ok\",\n \"sign\": \"d156527618e2ad096fdfb29c25716bdc68000fc81e0c9480c2c4f7f74e90cd7d666c42cb27c1ed2db1a213b4f54e7916fb8abad01c5249ae652fe0945436c7ff\"\n },\n \"des\": \"\"\n}","responseId":239240325,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"call_ad":{"type":"string","description":"Notification API Address"}},"x-apifox-orders":["app_id","device_number","timestamps","call_ad"],"required":["device_number","timestamps","app_id","call_ad"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"call_ad\": \"https://***/device/box/status/\"\r\n}"},"description":"Set api for get box status: https://api.bestwond.com/device/set/box/callback/address/","tags":["Users API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":42,"cases":[{"id":98476977,"type":"http","path":null,"name":"Success","responseId":239240325,"parameters":{"query":[{"id":"r8u0lOVz3s","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"call_ad\": \"https://***/device/box/status/\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"User API","auth":{},"parentId":18963420,"serverId":"","description":"","identityPattern":{"httpApi":{"type":"inherit","bodyType":"","fields":[]}},"preProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"postProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"inheritPostProcessors":{},"inheritPreProcessors":{},"items":[{"name":"Get box status api: User API","api":{"id":"95785726","method":"post","path":"https://api.bestwond.com/api/iot/device/callback/for/box/status/","parameters":{"query":[],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240319","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 ok"}},"x-apifox-orders":["code"],"required":["code"]}}],"responseExamples":[],"requestBody":{"type":"application/json","parameters":[],"jsonSchema":{"type":"object","properties":{"device_id":{"type":"string","description":"Device Id"},"lock_address":{"type":"string","description":"Lock adderss for box"},"lock_status":{"type":"string","description":"Lock 1: 1 door closed, 0 door open.\nLock 2: 0 door closed, 1 door open.\nPlease check which type of lock you have\n"}},"x-apifox-orders":["device_id","lock_address","lock_status"],"required":["device_id","lock_address","lock_status"]},"example":"{\r\n \"device_id\": \"2000012297\",\r\n \"lock_address\": \"0101\",\r\n \"lock_status\": 1\r\n}"},"description":"The user system is used to receive the box door status API [please provide it by imitating this API]","tags":[],"status":"developing","serverId":"","operationId":"","sourceUrl":"","ordering":6,"cases":[{"id":99202932,"type":"http","path":null,"name":"Success","responseId":239240319,"parameters":{"query":[],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_id\": \"2000012297\",\r\n \"lock_address\": \"0101\",\r\n \"lock_status\": 1\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}}]}]},{"name":"Save And Take By Bw","auth":{},"parentId":0,"serverId":"","description":"","identityPattern":{"httpApi":{"type":"inherit","bodyType":"","fields":[]}},"preProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"postProcessors":[{"id":"inheritProcessors","type":"inheritProcessors","data":{}}],"inheritPostProcessors":{},"inheritPreProcessors":{},"items":[{"name":"Express storage and retrieval API","api":{"id":"95785730","method":"post","path":"/api/iot/kd/order/save/or/take/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240323","name":"OK","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"integer"},"data":{"description":"Data","type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"status":{"type":"integer"},"lock_address":{"type":"string","description":"Lock Address"},"box_name":{"type":"string","description":"Open the box door"},"id":{"type":"integer"},"market_id":{"type":"integer"},"box_size":{"type":"string"},"box_type":{"type":"integer"},"uptime":{"type":"string"},"ctime":{"type":"string"},"remark":{"type":"string"},"rental_items_id":{"type":"integer"},"count":{"type":"integer"},"pick_phone":{"type":"string"},"save_time":{"type":"string"},"pick_code":{"type":"integer"},"pick_time":{"type":"string"},"order_no":{"type":"string"},"version":{"type":"integer"},"enable_status":{"type":"integer"}},"required":["id","market_id","device_number","box_name","box_size","box_type","lock_address","status","uptime","ctime","remark","rental_items_id","count","pick_phone","save_time","pick_code","pick_time","order_no","version","enable_status"],"x-apifox-orders":["device_number","status","lock_address","box_name","id","market_id","box_size","box_type","uptime","ctime","remark","rental_items_id","count","pick_phone","save_time","pick_code","pick_time","order_no","version","enable_status"]},"msg":{"type":"string","description":"Message"},"des":{"type":"string"}},"required":["code","msg","data","des"],"x-apifox-orders":["code","data","msg","des"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"id\": 9546, \n \"market_id\": 37, \n \"device_number\": \"2000012297\", \n \"box_name\": \"11\", \n \"box_size\": \"S\", \n \"box_type\": 2, \n \"lock_address\": \"010b\", \n \"status\": 1, \n \"uptime\": \"2022-12-27 10:50:11\", \n \"ctime\": \"2022-12-27 10:50:11\", \n \"remark\": null, \n \"rental_items_id\": null, \n \"count\": null, \n \"pick_phone\": null, \n \"save_time\": \"2023-01-06 15:24:10\", \n \"pick_code\": null, \n \"pick_time\": \"2023-01-06 15:25:00\", \n \"order_no\": \"230001\", \n \"version\": 0, \n \"enable_status\": 1\n }, \n \"des\": \"\"\n}\n","responseId":0,"ordering":1},{"name":"Order saved","data":"{\n \"code\": 30002, \n \"msg\": \"Order has been deposited.\", \n \"data\": null\n}\n","responseId":0,"ordering":2},{"name":"Exception","data":"{\r\n \"code\": \"310001\",\r\n \"msg\": \"Invalid storage code\"\r\n}\r\n\r\n{\r\n \"code\": \"320001\",\r\n \"msg\": \"Invalid pickup code\"\r\n}","responseId":239240323,"ordering":3}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"action_code":{"type":"string","description":"Saving or retrieving codes"},"action_type":{"type":"string","description":"save or take Operation method: save or take"},"box_size":{"type":"string","description":"save is required"}},"x-apifox-orders":["device_number","timestamps","app_id","action_code","action_type","box_size"],"required":["device_number","timestamps","app_id","action_code","action_type","box_size"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"action_code\": \"12772\",\r\n \"action_type\": \"take\",\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}"},"description":"Express storage and retrieval call interface: https://api.bestwond.com/api/iot/kd/order/save_or_take/","tags":["Not ok"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":30,"cases":[{"id":99171726,"type":"http","path":null,"name":"Take","responseId":239240323,"parameters":{"query":[{"id":"2crk0SRG7u","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"action_code\": \"12772\",\r\n \"action_type\": \"take\",\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Set Express storage and retrieval Webhook","api":{"id":"99445956","method":"post","path":"/api/iot/set/app/webhook/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"247630691","name":"OK","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string","description":"Message"},"data":{"type":"null"},"des":{"type":"string"}},"required":["code","msg","data","des"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": null, \n \"des\": \"\"\n}\n","responseId":247630691,"ordering":1},{"name":"Order saved","data":"{\n \"code\": 30002, \n \"msg\": \"Order has been deposited.\", \n \"data\": null\n}\n","responseId":247630691,"ordering":2},{"name":"Exception","data":"{\r\n \"code\": \"310001\",\r\n \"msg\": \"Invalid storage code\"\r\n}\r\n\r\n{\r\n \"code\": \"320001\",\r\n \"msg\": \"Invalid pickup code\"\r\n}","responseId":247630691,"ordering":3}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"save_notify_url":{"type":"string","description":"Save notify webhook"},"take_notify_url":{"type":"string","description":"Take notify webhook"}},"x-apifox-orders":["app_id","timestamps","save_notify_url","take_notify_url"],"required":["save_notify_url","timestamps","app_id","take_notify_url"]},"generateMode":"normal","example":"{\r\n \"save_notify_url\": \"https://api.bestwond.com/api/iot/test/app/webhook/\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"take_notify_url\": \"https://api.bestwond.com/api/iot/test/app/webhook/\"\r\n}\r\n"},"description":"When call Express storage and retrieval call interface, the app webhook will triger when save or take success.","tags":["Not ok"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":31,"cases":[{"id":101221793,"type":"http","path":null,"name":"Success","responseId":247630691,"parameters":{"query":[{"id":"2crk0SRG7u","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"save_notify_url\": \"https://dgndev.bestwond.com/api/iot/test/app/webhook/\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"take_notify_url\": \"https://dgndev.bestwond.com/api/iot/test/app/webhook/\"\r\n}\r\n","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{"240538742":false},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Set orders that can be saved in","api":{"id":"95785731","method":"post","path":"/api/iot/kd/set/save/order/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"239240324","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 Indicates successful API call"},"data":{"description":"Data","type":"object","properties":{"app_id":{"type":"string","description":"App Id"},"sign":{"type":"string","description":"sign"},"device_number":{"type":"string","description":"Device Id"},"status":{"type":"string","description":"0 indicates successful sending to the device"},"timestamps":{"type":"string","description":"Time stamp"},"order_no":{"type":"string","description":"Lock Address"},"box_name":{"type":"string","description":"Can be stored in the door, not the actual storage door. When actually storing, first determine whether there is an empty door, and then select a storage option"},"save_code":{"type":"string","description":"Deposit code"},"take_code":{"type":"string","description":"Pickup code"},"box_size":{"type":"string","description":"Box door size"}},"x-apifox-orders":["app_id","device_number","order_no","box_size","box_name","save_code","take_code","timestamps","status","sign"],"required":["app_id","sign","status","device_number","timestamps","order_no","save_code","box_name","take_code","box_size"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"timestamps\": 1689746391, \n \"order_no\": \"100007\", \n \"box_name\": \"05,07,06,09,08,12,10,11,20,18,23,24,17,22\", \n \"box_size\": \"S\", \n \"save_code\": \"875813\", \n \"pick_code\": \"632118\", \n \"status\": \"success\", \n \"msg\": \"ok\"\n }, \n \"des\": \"\"\n}\n","responseId":239240324,"ordering":1},{"name":"Exception","data":"{\r\n \"code\": \"30001\",\r\n \"msg\": \"Order already booked\"\r\n}\r\n\r\n\r\n{\r\n \"code\": \"30002\",\r\n \"msg\": \"Order has been deposited\"\r\n}\r\n\r\n\r\n{\r\n \"code\": \"30003\",\r\n \"msg\": \"Order has been withdrawn\"\r\n}","responseId":239240324,"ordering":2}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"order_no":{"type":"string","description":"ExpressNumber"},"box_size":{"type":"string","enum":["S","M","L","SX","LX"],"x-apifox":{"enumDescriptions":{"S":"Small Box","M":"Middle Box","L":"Largger Box","SX":"Ultra Small Box","LX":"Extra Large Box"}},"description":"Box size : S small , M middle, L lagger"}},"x-apifox-orders":["app_id","device_number","timestamps","order_no","box_size"],"required":["device_number","timestamps","app_id","order_no","box_size"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"order_no\": \"100007\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}"},"description":"Set orders that can be saved : https://api.bestwond.com/api/iot/kd/set/save/order/","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":36,"cases":[{"id":99058066,"type":"http","path":null,"name":"Success","responseId":239240324,"parameters":{"query":[{"id":"LXhs43NrDC","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"order_no\": \"100007\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Set orders that can be saved and set get user Email","api":{"id":"98861949","method":"post","path":"/api/iot/kd/set/save/order/by/email/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"246324714","name":"成功","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string","description":"0 Indicates successful API call"},"data":{"description":"Data","type":"object","properties":{"app_id":{"type":"string","description":"App Id"},"sign":{"type":"string","description":"sign"},"device_number":{"type":"string","description":"Device Id"},"status":{"type":"string","description":"0 indicates successful sending to the device"},"timestamps":{"type":"string","description":"Time stamp"},"order_no":{"type":"string","description":"Lock Address"},"box_name":{"type":"string","description":"Can be stored in the door, not the actual storage door. When actually storing, first determine whether there is an empty door, and then select a storage option"},"save_code":{"type":"string","description":"Deposit code"},"take_code":{"type":"string","description":"Pickup code"},"box_size":{"type":"string","description":"Box door size"}},"x-apifox-orders":["app_id","device_number","order_no","box_size","box_name","save_code","take_code","timestamps","status","sign"],"required":["app_id","sign","status","device_number","timestamps","order_no","save_code","box_name","take_code","box_size"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"app_id\": \"bw_de2767d821f911e\", \n \"device_number\": \"2000012297\", \n \"timestamps\": 1689746391, \n \"order_no\": \"100007\", \n \"box_name\": \"05,07,06,09,08,12,10,11,20,18,23,24,17,22\", \n \"box_size\": \"S\", \n \"save_code\": \"875813\", \n \"pick_code\": \"632118\", \n \"status\": \"success\", \n \"msg\": \"ok\"\n }, \n \"des\": \"\"\n}\n","responseId":246324714,"ordering":1},{"name":"Exception","data":"{\r\n \"code\": \"30001\",\r\n \"msg\": \"Order already booked\"\r\n}\r\n\r\n\r\n{\r\n \"code\": \"30002\",\r\n \"msg\": \"Order has been deposited\"\r\n}\r\n\r\n\r\n{\r\n \"code\": \"30003\",\r\n \"msg\": \"Order has been withdrawn\"\r\n}","responseId":246324714,"ordering":2}],"requestBody":{"type":"application/json","parameters":[],"jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"order_no":{"type":"string","description":"ExpressNumber"},"box_size":{"type":"string","enum":["S","M","L","SX","LX"],"x-apifox":{"enumDescriptions":{"S":"Small Box","M":"Middle Box","L":"Largger Box","SX":"Ultra Small Box","LX":"Extra Large Box"}},"description":"Box size : S small , M middle, L lagger"},"notice_email":{"type":"string","description":"Get user email"}},"x-apifox-orders":["app_id","device_number","timestamps","order_no","box_size","notice_email"],"required":["device_number","timestamps","app_id","order_no","box_size","notice_email"]},"example":"{\r\n \"device_number\": \"2000012297\",\r\n \"order_no\": \"100011\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"notice_email\": \"785707939@qq.com\"\r\n}"},"description":"Set orders that can be saved and set get user email : https://api.bestwond.com/api/iot/kd/set/save/order/by/email/.\n\nIt is recommended not to use this API. Because This API sends emails to the recipient, but the email content format does not support setting and modification.\n","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":38,"cases":[{"id":100756368,"type":"http","path":null,"name":"Success","responseId":246324714,"parameters":{"query":[{"id":"LXhs43NrDC","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"order_no\": \"100007\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{"240538742":false},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device box doors that can be stored","api":{"id":"96501406","method":"post","path":"/api/iot/kd/get/can/save/box/","parameters":{"query":[{"id":"7TRckb14IQ","name":"sign","required":true,"description":"Obtained through signature","type":"string","enable":true}],"path":[],"cookie":[],"header":[]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"240945998","name":"OK","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"integer","description":"0 ok"},"msg":{"type":"string","description":"Message"},"data":{"type":"object","properties":{"can_save_box_list":{"type":"string","description":"Can be save box list now"}},"required":["can_save_box_list"],"x-apifox-orders":["can_save_box_list"],"description":"data"},"des":{"type":"string","description":"description or notice"}},"required":["code","msg","data","des"],"x-apifox-orders":["code","msg","data","des"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": {\n \"can_save_box_list\": \"05,07,06,09,08,12,10,11,20,18,23,24,17,22\"\n }, \n \"des\": \"If can_save_box_list equals empty, you can still save order, may be when you save, has empty boxes, this is decided by you\"\n}\n","responseId":240945998,"ordering":1},{"name":"Exception","data":"{\r\n \"code\": \"30001\",\r\n \"msg\": \"Order already booked\"\r\n}\r\n\r\n\r\n{\r\n \"code\": \"30002\",\r\n \"msg\": \"Order has been deposited\"\r\n}\r\n\r\n\r\n{\r\n \"code\": \"30003\",\r\n \"msg\": \"Order has been withdrawn\"\r\n}","responseId":240945998,"ordering":2}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"timestamps":{"type":"string","description":"Timestamps"},"app_id":{"type":"string","description":"App Id"},"box_size":{"type":"string","enum":["S","M","L","SX","LX"],"x-apifox":{"enumDescriptions":{"S":"Small Box","M":"Middle Box","L":"Largger Box","SX":"Ultra Small Box","LX":"Extra Large Box"}},"description":"Box size : S small , M middle, L lagger"}},"x-apifox-orders":["app_id","device_number","timestamps","box_size"],"required":["device_number","timestamps","app_id","box_size"]},"generateMode":"normal","example":"{\r\n \"device_number\": \"2100013075\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}"},"description":"Set orders that can be saved : https://api.bestwond.com/api/iot/kd/set/save/order/","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":41,"cases":[{"id":99029430,"type":"http","path":null,"name":"Success","responseId":240945998,"parameters":{"query":[{"id":"qQZk5Fg3RR","relatedId":"7TRckb14IQ","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"device_number\": \"2100013075\",\r\n \"box_size\": \"S\",\r\n \"timestamps\": 6544215251125,\r\n \"app_id\": \"bw_de2767d821f911e\"\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device box used info","api":{"id":"96506388","method":"post","path":"/api/iot/get/device/tj/info/","parameters":{"query":[{"required":false,"description":"","type":"string","id":"7dk5OExj3q","example":"","enable":true,"name":"sign"}]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"240958837","name":"OK","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"device_number":{"type":"string"},"timestamps":{"type":"integer"},"left_box_count":{"type":"integer"},"used_box_count":{"type":"integer"},"disabled_box_count":{"type":"integer"},"already_sysnc_count":{"type":"integer"},"already_save_count":{"type":"integer"},"already_take_count":{"type":"integer"},"box_size_count":{"type":"array","items":{"type":"object","properties":{"count":{"type":"integer"},"box_size":{"type":"string"},"status":{"type":"integer","enum":[1,2],"x-apifox":{"enumDescriptions":{"1":"Empty","2":"Full"}}}},"required":["count","box_size","status"],"x-apifox-orders":["count","box_size","status"]}},"sign":{"type":"string"}},"required":["device_number","timestamps","left_box_count","used_box_count","disabled_box_count","already_sysnc_count","already_save_count","already_take_count","box_size_count","sign"],"x-apifox-orders":["device_number","timestamps","left_box_count","used_box_count","disabled_box_count","already_sysnc_count","already_save_count","already_take_count","box_size_count","sign"]},"des":{"type":"string"}},"required":["code","msg","data","des"],"x-apifox-orders":["code","msg","data","des"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"SUCCESS\", \n \"data\": {\n \"device_number\": \"2000012297\", \n \"timestamps\": 1689730943, \n \"left_box_count\": 22, \n \"used_box_count\": 2, \n \"disabled_box_count\": 0, \n \"already_sysnc_count\": 16, \n \"already_save_count\": 7, \n \"already_take_count\": 39, \n \"box_size_count\": [\n {\n \"count\": 4, \n \"box_size\": \"L\", \n \"status\": 1\n }, \n {\n \"count\": 4, \n \"box_size\": \"M\", \n \"status\": 1\n }, \n {\n \"count\": 14, \n \"box_size\": \"S\", \n \"status\": 1\n }, \n {\n \"count\": 2, \n \"box_size\": \"S\", \n \"status\": 2\n }\n ], \n \"sign\": \"f260140b7cc3d578371097c3ae4d69f4aa3eee9ee273181e72d9d943fd2f505ecad047f0e1fcfc493bfb2f4dd9147d5e201109a61918edc5e526c7381534eef5\"\n }, \n \"des\": \"\"\n}\n","responseId":240958837,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"device_number":{"type":"string","description":"Device Id"},"app_id":{"type":"string","description":"App Id"}},"x-apifox-orders":["device_number","app_id"],"required":["device_number","app_id"]},"generateMode":"normal","example":"{\n \"device_number\": \"2100013075\",\n \"app_id\": \"bw_de2767d821f911e\",\n \"timestamps\": 123123213\n}"},"description":"","tags":[],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":56,"cases":[{"id":98961667,"type":"http","path":null,"name":"Success","responseId":240958837,"parameters":{"query":[{"id":"k4IUyaZ77r","relatedId":"7dk5OExj3q","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\n \"device_number\": \"2100013075\",\n \"app_id\": \"bw_de2767d821f911e\",\n \"timestamps\": 123123213\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{}","advancedSettings":{},"mockScript":{},"codeSamples":[],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}},{"name":"Get device box save order info","api":{"id":"96239485","method":"post","path":"/api/iot/device/get/box/save/info/","parameters":{"query":[{"required":false,"description":"","type":"string","id":"l0bTwPhyTX","example":"","enable":true,"name":"sign"}]},"auth":{},"commonParameters":{"query":[],"body":[],"cookie":[],"header":[]},"responses":[{"id":"240291325","name":"OK","code":200,"contentType":"json","jsonSchema":{"type":"object","properties":{"code":{"type":"string"},"data":{"type":"object","properties":{"box_name":{"type":"string","description":"Box name"},"lock_address":{"type":"string","description":"Box lock adderss"},"box_size":{"type":"string","enum":["S","M","L","SX","LX"],"x-apifox":{"enumDescriptions":{"S":"Small Box","M":"Middle Box","L":"Largger Box","SX":"Ultra Small Box","LX":"Extra Large Box"}},"description":"Box size : S small , M middle, L lagger"},"device_number":{"type":"string","description":"Device Id"},"box_status":{"type":"integer","enum":[1,2],"x-apifox":{"enumDescriptions":{"1":"Empty","2":"Full"}},"description":"Box status 1 empty 2 full"},"enable_status":{"type":"integer","enum":[1,2],"x-apifox":{"enumDescriptions":{"1":"Normal","2":"Disabled"}},"description":"Box disable status: 1 ok 2 disabled"},"order_no":{"type":"string","description":"Order no"},"box_id":{"type":"string","description":"Box Id"}},"x-apifox-orders":["box_id","box_name","lock_address","box_size","device_number","box_status","enable_status","order_no"],"required":["box_id","box_status","device_number","box_size","lock_address","box_name","order_no","enable_status"]},"msg":{"type":"string","description":"Message"}},"x-apifox-orders":["code","data","msg"],"required":["code","data","msg"]}}],"responseExamples":[{"name":"Success","data":"{\n \"code\": 0, \n \"msg\": \"Operation successful\", \n \"data\": [\n {\n \"box_id\": 9534, \n \"box_size\": \"L\", \n \"box_name\": \"01\", \n \"lock_address\": \"0101\", \n \"device_number\": \"2000012297\", \n \"box_status\": 1, \n \"enable_status\": 1, \n \"order_no\": \"6903244679947\", \n \"save_time\": \"2023-01-10 18:02:19\"\n }\n ], \n \"des\": \"\"\n}\n","responseId":240291325,"ordering":1}],"requestBody":{"parameters":[],"type":"application/json","jsonSchema":{"type":"object","properties":{"app_id":{"type":"string","description":"App Id"},"device_number":{"type":"string","description":"Device Id"},"box_name":{"type":"string","description":"Box name"},"timestamps":{"type":"string","description":"time stamp"}},"x-apifox-orders":["app_id","device_number","box_name","timestamps"],"required":["app_id","device_number","box_name","timestamps"]},"generateMode":"normal","example":"{\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"device_number\": \"2100013075\",\r\n \"box_name\": \"01\",\r\n \"timestamps\": 6544215251125\r\n}"},"description":"Get device box save order info: https://api.bestwond.com/api/iot/device/get/box/save/info/","tags":["API"],"status":"released","serverId":"","operationId":"","sourceUrl":"","ordering":46,"cases":[{"id":98836690,"type":"http","path":null,"name":"Success","responseId":240291325,"parameters":{"query":[{"id":"zdSc9DeRU1","relatedId":"l0bTwPhyTX","relatedName":"sign","value":"","enable":true,"isDelete":false}],"path":[],"cookie":[],"header":[]},"commonParameters":{"query":[],"body":[],"header":[],"cookie":[]},"requestBody":{"parameters":[],"data":"{\r\n \"app_id\": \"bw_de2767d821f911e\",\r\n \"device_number\": \"2100013075\",\r\n \"box_name\": \"01\",\r\n \"timestamps\": 6544215251125\r\n}","generateMode":"normal"},"auth":{},"advancedSettings":{"isDefaultUrlEncoding":1},"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}],"mocks":[],"customApiFields":"{\"Python code demo\":\"\"}","advancedSettings":{"isDefaultUrlEncoding":1},"mockScript":{},"codeSamples":[{"name":"app_info.py","prompt":"","language":"python","code":"api_host = \"https://api.bestwond.com\"\r\napp_id = \"bw_de2767d821f911e\"\r\napp_secret = \"de27690e21f911eda66200163e198b20\"\r\ndevice_number = \"2000012297\"\r\n\r\nimport hashlib\r\n\r\ndef create_sign(pay_data, mch_key):\r\n \"\"\"\r\n data sign\r\n :param mch_key:\r\n :param pay_data:\r\n :return:\r\n \"\"\"\r\n from urllib.parse import urlencode\r\n npay_data = {}\r\n for k in sorted(pay_data):\r\n npay_data[k] = pay_data[k]\r\n params = urlencode(npay_data)\r\n print(params)\r\n stringSignTemp = \"{}{}\".format(params, mch_key)\r\n print(\"stringSignTemp==\", stringSignTemp)\r\n sign = hashlib.sha512(stringSignTemp.encode('utf-8')).hexdigest()\r\n return sign"},{"name":"GetDeviceBoxSaveInfo.py","prompt":"","language":"python","code":"import requests\r\nimport json\r\nimport time\r\n\r\nfrom app_info import *\r\n\r\ndata = {\r\n \"device_number\": device_number,\r\n \"box_name\": \"01\",\r\n \"timestamps\": int(time.time()),\r\n \"app_id\": app_id\r\n}\r\nheaders = {\r\n 'Content-Type': 'application/json'\r\n }\r\nsign = create_sign(data, app_secret)\r\nres = requests.post(api_host + \"/api/iot/device/get/box/save/info/?sign=%s\" % sign, data=json.dumps(data), headers=headers)\r\n\r\nprint(sign)\r\nprint(res.status_code)\r\nprint(res.text)\r\nprint(res.json())"}],"commonResponseStatus":{},"responseChildren":[],"preProcessors":[],"postProcessors":[],"inheritPostProcessors":{},"inheritPreProcessors":{}}}]}]}],"socketCollection":[],"docCollection":[{"name":"Root","children":[{"name":"Cabinet Released Api","children":[],"items":[{"id":2731455,"name":"Cabinet Released Api","content":"Before making an API request, it is necessary to sign the parameters and then proceed with the request.\n\n## Step1. Import apifox.json to ApiFox and Set ApiFox Enviroment:\n\n![api fox5.png](https://api.apifox.cn/api/v1/projects/3018175/resources/391337/image-preview)\n\n\n![api fox1.png](https://api.apifox.cn/api/v1/projects/3018175/resources/391349/image-preview)\n\n## Step2. API fox set 【Pre Processors】Code is:\n\n```\n// Obtain an app that is pre-set as an environment variable_ ID and app_ Sceecret\nvar app_id = pm.environment.get('app_id')\nvar app_secret = pm.environment.get('app_secret')\n\nconsole.log(\"app_id==\", app_id)\nconsole.log(\"app_secret==\", app_secret)\n\nvar data = pm.request.body.raw;\nconsole.log(\"data=\", data);\nvar sign = pm.execute('sign.py', [data, app_secret]);\n// Get Query Parameter Object\nvar queryParams = pm.request.url.query\npm.environment.set(\"sign\", sign);\n\nconsole.log(sign);\n\nqueryParams.upsert({\n key: 'sign',\n value: sign\n})\n```\n\nsign.py code:\n```\nimport hashlib\nimport json\n\ndef create_sign(pay_data, mch_key):\n from urllib.parse import urlencode\n npay_data = {}\n pay_data = json.loads(pay_data)\n for k in sorted(pay_data):\n npay_data[k] = pay_data[k]\n params = urlencode(npay_data)\n # print(params)\n stringSignTemp = \"{}{}\".format(params, mch_key)\n # print(\"stringSignTemp==\", stringSignTemp)\n sign = hashlib.sha512(stringSignTemp.encode('utf-8')).hexdigest()\n return sign\n\nif __name__ == '__main__':\n import sys\n argv = sys.argv[1:]\n a = create_sign(argv[0], argv[1])\n print(a)\n```\n\nput sign code on external code directory:\n\n\n![api fox4.png](https://api.apifox.cn/api/v1/projects/3018175/resources/391314/image-preview)\n\n![api fox2.png](https://api.apifox.cn/api/v1/projects/3018175/resources/391310/image-preview)\n\n\n## Step3. Code Test:\n\n### Python sign code:\n\n```\nimport hashlib\n\ndef create_sign(pay_data, mch_key):\n \"\"\"\n 签名加密\n :param mch_key:\n :param pay_data:\n :return:\n \"\"\"\n from urllib.parse import urlencode\n npay_data = {}\n for k in sorted(pay_data):\n npay_data[k] = pay_data[k]\n params = urlencode(npay_data)\n print(params)\n stringSignTemp = \"{}{}\".format(params, mch_key)\n print(\"stringSignTemp==\", stringSignTemp)\n sign = hashlib.sha512(stringSignTemp.encode('utf-8')).hexdigest()\n return sign\n```\n\n### Java open box code:\n```\npackage com.bestwond.test;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.nio.charset.StandardCharsets;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.TreeMap;\n\npublic class OpenBoxDemo {\n\n public static String getPost(String url, Map<String, String> heads,\n Map<String, String> params) throws IOException {\n\n URL u;\n HttpURLConnection connection = null;\n OutputStream out;\n try {\n u = new URL(url);\n connection = (HttpURLConnection) u.openConnection();\n connection.setRequestMethod(\"POST\");\n connection.setConnectTimeout(30000);\n connection.setReadTimeout(30000);\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\n connection.setDoOutput(true);\n connection.setDoInput(true);\n if (heads != null) {\n for (Map.Entry<String, String> stringStringEntry : heads.entrySet()) {\n connection.setRequestProperty(stringStringEntry.getKey(),\n stringStringEntry.getValue());\n }\n }\n\n out = connection.getOutputStream();\n if (params != null && !params.isEmpty()) {\n out.write(toJSONString(params).getBytes());\n }\n out.flush();\n out.close();\n\n InputStream is = connection.getInputStream();\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n int i;\n while ((i = is.read()) != -1) {\n baos.write(i);\n }\n return baos.toString();\n\n } catch (Exception e) {\n throw e;\n }\n }\n\n public static String toJSONString(Map<String, String> map) {\n Iterator<Map.Entry<String, String>> i = map.entrySet().iterator();\n if (!i.hasNext()) {\n return \"{}\";\n }\n StringBuilder sb = new StringBuilder();\n sb.append('{');\n for (; ; ) {\n\n Map.Entry<String, String> e = i.next();\n String key = e.getKey();\n String value = e.getValue();\n sb.append(\"\\\"\");\n sb.append(key);\n sb.append(\"\\\"\");\n sb.append(':');\n sb.append(\"\\\"\");\n sb.append(value);\n sb.append(\"\\\"\");\n if (!i.hasNext()) {\n return sb.append('}').toString();\n }\n sb.append(',').append(' ');\n }\n }\n\n public static String create_sign(String params, String app_secret) {\n params = params + app_secret;\n byte[] bytes = params.getBytes(StandardCharsets.UTF_8);\n MessageDigest messageDigest;\n try {\n messageDigest = MessageDigest.getInstance(\"SHA-512\");\n messageDigest.update(bytes);\n } catch (NoSuchAlgorithmException e) {\n throw new RuntimeException(\"SHA sign error\");\n }\n byte[] digest = messageDigest.digest();\n return byteArrayToHexString(digest);\n }\n\n private static String byteArrayToHexString(byte[] bytes) {\n StringBuilder builder = new StringBuilder();\n for (byte b : bytes) {\n String temp = Integer.toHexString(b & 0xFF);\n if (temp.length() == 1) {\n builder.append(\"0\");\n }\n builder.append(temp);\n }\n return builder.toString();\n }\n\n\n public static void main(String[] args) throws IOException {\n Map<String,String> map =new TreeMap<>((k1, k2)->{\n return k1.compareTo(k2);\n });\n\n map.put(\"app_id\", \"bw_de27*******11e\");\n map.put(\"timestamps\", String.valueOf(System.currentTimeMillis()/1000));\n map.put(\"device_number\", \"200****001\");\n map.put(\"lock_address\", \"0101\");\n map.put(\"use_type\", \"S\");\n\n StringBuilder sb = new StringBuilder();\n for (Map.Entry<String, String> entry : map.entrySet()) {\n sb.append(entry.getKey() + \"=\" + entry.getValue() + \"&\");\n }\n String params = sb.toString();\n if (sb.length() > 0) {\n params = sb.substring(0, sb.length()-1);\n }\n String sign = create_sign(params, \"de27690e21f911e**********e198b20\");\n map.put(\"sign\", sign);\n Map<String,String> headers = new HashMap<>();\n\n String result = getPost(\"https://api.bestwond.com/api/iot/open/box/?sign=\"+sign, headers, map);\n System.out.println(result);\n }\n}\n\n```\n\n### Php open box code:\n```\n<?php\n$secret = 'de27690e21f911e**********e198b20'; // Signature Secret\n$app_id = 'bw_de27*******11e';\n$fields = array( 'app_id' => $app_id,\n 'device_number' => '200****001',\n\t\t\t\t'lock_address' => '0101',\n\t\t\t\t'use_type' => 'S',\n\t\t\t\t'timestamps' => time());\nksort($fields);\necho $fields;\n$sign = hash('SHA512', http_build_query($fields) . $secret);\necho http_build_query($fields) . $secret;\necho '-----------iot openbox create sign--------------\\n';\necho $sign;\necho '-----------iot openbox api test--------------\\n';\necho http_build_query($fields);\n$curl = curl_init();\necho '-----------iot openbox teststart--------------\\n';\ncurl_setopt_array($curl, array(\n CURLOPT_URL => 'https://dgndev.bestwond.com/api/iot/open/box/?sign='.$sign,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => '',\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 0,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => 'POST',\n CURLOPT_POSTFIELDS =>json_encode($fields),\n CURLOPT_HTTPHEADER => array(\n 'Content-Type: application/json',\n ),\n));\necho '-----------$curl--------------\\n';\necho $curl;\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\necho '----------$response-------------\\n';\n?>\n```","folderId":18962253,"type":"folder"}]},{"name":"How to Get Box Door Status","children":[{"name":"User API","children":[],"items":[]}],"items":[]},{"name":"Save And Take By Bw","children":[],"items":[]}],"items":[]}],"schemaCollection":[],"responseCollection":[{"id":3014340,"createdAt":"2023-07-21T13:57:29.000Z","updatedAt":"2023-07-21T13:57:29.000Z","deletedAt":null,"name":"Root","type":"root","description":"","children":[],"auth":{},"projectId":3018175,"parentId":0,"createdById":624818,"updatedById":624818,"items":[{"id":240538742,"name":"Missing parameter","code":200,"contentType":"json","jsonSchema":{"title":"","type":"object","properties":{"code":{"type":"integer","description":"10000"},"msg":{"type":"string","description":"Missing parameter"}},"x-apifox-orders":["code","msg"],"required":["code","msg"]},"defaultEnable":false,"folderId":0,"responseExamples":[]}]}],"apiTestCaseCollection":[{"name":"Root","children":[],"items":[]}],"testCaseReferences":[],"environments":[],"commonScripts":[{"name":"php code for open box","description":"","content":"<?php\r\n$secret = 'de27690e21f911eda66200163e198b20'; // Signature Secret\r\n$app_id = 'bw_de2767d821f911e';\r\n$fields = array( 'app_id' => $app_id,\r\n 'device_number' => '2000012297',\r\n\t\t\t\t'lock_address' => '0101',\r\n\t\t\t\t'use_type' => 'S',\r\n\t\t\t\t'timestamps' => time());\r\nksort($fields);\r\necho $fields;\r\n$sign = hash('SHA512', http_build_query($fields) . $secret);\r\necho http_build_query($fields) . $secret;\r\necho '-----------iot openbox create sign--------------\\n';\r\necho $sign;\r\necho '-----------iot openbox api test--------------\\n';\r\necho http_build_query($fields);\r\n$curl = curl_init();\r\necho '-----------iot openbox teststart--------------\\n';\r\ncurl_setopt_array($curl, array(\r\n CURLOPT_URL => 'https://dgndev.bestwond.com/api/iot/open/box/?sign='.$sign,\r\n CURLOPT_RETURNTRANSFER => true,\r\n CURLOPT_ENCODING => '',\r\n CURLOPT_MAXREDIRS => 10,\r\n CURLOPT_TIMEOUT => 0,\r\n CURLOPT_FOLLOWLOCATION => true,\r\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\r\n CURLOPT_CUSTOMREQUEST => 'POST',\r\n CURLOPT_POSTFIELDS =>json_encode($fields),\r\n CURLOPT_HTTPHEADER => array(\r\n 'Content-Type: application/json',\r\n ),\r\n));\r\necho '-----------$curl--------------\\n';\r\necho $curl;\r\n$response = curl_exec($curl);\r\n\r\ncurl_close($curl);\r\necho $response;\r\necho '----------$response-------------\\n';\r\n?>","runMode":"independent","stickyOrdering":10,"ordering":10,"id":"433406"}],"databaseConnections":[],"globalVariables":[{"id":"3018175","variables":[{"name":"app_secret","value":"de27690e21f911eda66200163e198b20","description":"","isBindInitial":true,"initialValue":"de27690e21f911eda66200163e198b20"},{"name":"app_id","value":"bw_de2767d821f911e","description":"","isBindInitial":true,"initialValue":"bw_de2767d821f911e"},{"name":"sign","value":"1","description":"","isBindInitial":true,"initialValue":"1"}]}],"commonParameters":null,"projectSetting":{"id":"2444234","auth":{},"servers":[{"id":"default","name":"Default Server"}],"gateway":[],"language":"en-US","apiStatuses":["developing","testing","released","deprecated","designing"],"mockSettings":{},"preProcessors":[{"type":"customScript","data":"\r\n\r\n// 获取预先设置为环境变量的 APPID 和 SECRET_KEY\r\nvar app_id = pm.environment.get('app_id')\r\nvar app_secret = pm.environment.get('app_secret')\r\n\r\nconsole.log(\"app_id==\", app_id)\r\nconsole.log(\"app_scecret==\", app_secret)\r\n\r\nvar data = pm.request.body.raw;\r\nconsole.log(\"data=\", data);\r\nvar sign = pm.execute('sign.py', [data, app_secret]);\r\n// 获取 Query 参数对象\r\nvar queryParams = pm.request.url.query\r\npm.environment.set(\"sign\", sign);\r\n\r\nconsole.log(sign);\r\n\r\nqueryParams.upsert({\r\n key: 'sign',\r\n value: sign\r\n})","defaultEnable":true,"enable":true,"id":"LgsYagWaHnUtc2nIICyT7","executionTiming":"prerequest"}],"postProcessors":[],"advancedSettings":{"responseValidate":true,"enableJsonc":true,"isDefaultUrlEncoding":2,"enableBigint":false,"enableTestScenarioSetting":true},"initialDisabledMockIds":[],"cloudMock":{"security":"free","enable":false,"tokenKey":"apifoxToken"}}}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/BestWondTim/cabinet_api_v3_code_demo.git
git@gitee.com:BestWondTim/cabinet_api_v3_code_demo.git
BestWondTim
cabinet_api_v3_code_demo
cabinet_api_v3_code_demo
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385