{"_id":"56720127c17bf90d00b95845","__v":0,"editedParams2":true,"project":"55dcd6a68a3dcd2300cc5f76","category":{"_id":"55e49e35830ec32300e1a391","pages":["55e49f04de0d360d0027bc68","55e5f0bc9416190d00dc3a47","5609d60f9f85a70d00908572","5609d65c96ff420d004c8771","564f5cdaea8cef1900ae505e","56720127c17bf90d00b95845","5676d160511d400d0070f2fc"],"project":"55dcd6a68a3dcd2300cc5f76","version":"55dcd6a78a3dcd2300cc5f79","__v":7,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-31T18:34:29.204Z","from_sync":false,"order":1,"slug":"web-api-calls","title":"Web API Calls"},"editedParams":true,"user":"55dcd49b0efd5821000d5358","version":{"_id":"55dcd6a78a3dcd2300cc5f79","project":"55dcd6a68a3dcd2300cc5f76","__v":3,"createdAt":"2015-08-25T20:57:11.187Z","releaseDate":"2015-08-25T20:57:11.187Z","categories":["55dcd6a78a3dcd2300cc5f7a","55dce1048a3dcd2300cc5f96","55e49e35830ec32300e1a391"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"22.0.0","version":"22"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-17T00:26:15.063Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"post","results":{"codes":[{"status":200,"language":"json","code":"{\n    \"status\": \"true\",\n    \"connection\": {\n        \"deviceaddress\": \"80:00:00:05:46:00:74:E6\",\n        \"expirationsec\": \"1790\",\n        \"imageintervalms\": \"1000\",\n        \"proxy\": \"http://proxy4.yoics.net:31067\",\n        \"requested\": \"12/16/2015T7:41 PM\",\n        \"status\": \"http://proxy4.yoics.net:31067\",\n        \"streamscheme\": [\n            null\n        ],\n        \"streamuri\": [\n            null\n        ],\n        \"url\": [\n            null\n        ]\n    }\n}","name":""},{"language":"json","status":403,"code":"{\n    \"status\": \"false\",\n    \"reason\": \"[0405] 80:00:00:05:46:00:74:E1 is not available for public access and is not shared with you.\"\n}"}]},"settings":"","examples":{"codes":[{"language":"curl","code":"curl -s -S -X POST -H \"content-type:application/json\" -H \"apikey:WeavedDemoKey\\$2015\" -H \"token:80f7a33a717b66fd13f6555b81181dd7\" --data '{\"deviceaddress\":\"80:00:00:05:46:00:87:99\", \"hostip\":\"36.143.180.96\",\"wait\":\"true\"}' https://api.weaved.com/v22/api/device/connect","name":""},{"language":"python","code":"import httplib2\nfrom urllib2 import urlopen\nimport json\nfrom json import dumps\n   \napiMethod=\"https://\"\napiServer=\"api.weaved.com\"\napiVersion=\"/v22\"\napiKey=\"WeavedDemoKey$2015\"\n\n# replace this with the actual UID of your device\nUID=\"00:00:00:00:00:00:00:00\"\n# get a valid login token from /user/login API call\ntoken=\"\"\n\n# you'll need to send a valid login token from /user/login\n\ndef proxyConnect(UID, token):\n    httplib2.debuglevel     = 0\n    http                    = httplib2.Http()\n    content_type_header     = \"application/json\"\n\n  # this is equivalent to \"whatismyip.com\"\n    my_ip = urlopen('http://ip.42.pl/raw').read()\n    proxyConnectURL = apiMethod + apiServer + apiVersion + \"/api/device/connect\"\n\n    proxyHeaders = {\n                'Content-Type': content_type_header,\n                'apikey': apiKey,\n                'token': token\n            }\n\n    proxyBody = {\n                'deviceaddress': UID,\n                'hostip': my_ip,\n                'wait': \"true\"\n            }\n\n    response, content = http.request( proxyConnectURL,\n                                          'POST',\n                                          headers=proxyHeaders,\n                                          body=dumps(proxyBody),\n                                       )\n    try:\n        data = json.loads(content)[\"connection\"][\"proxy\"]\n        print data\n    except KeyError:\n        print \"Key Error exception!\"\n        print content\n\nif __name__ == '__main__':\n    proxyConnect(UID, token)"}]},"auth":"required","params":[{"_id":"564f638e33082f0d001bb713","ref":"","in":"body","required":false,"desc":"Weaved UID of target daemon","default":"","type":"string","name":"deviceaddress"},{"_id":"564f638e33082f0d001bb712","ref":"","in":"body","required":false,"desc":"Public IP address of sender","default":"","type":"string","name":"hostip"},{"_id":"56720127c17bf90d00b95846","ref":"","in":"body","required":false,"desc":"Whether or not to wait until the connection completes","default":"","type":"boolean","name":"wait"}],"url":"/device/connect"},"isReference":false,"order":999,"body":"You will need to supply the token received from a valid login using the /user/login call.  This call makes a connection through Weaved's proxy server to the service, given the UID.\n\n**deviceaddress** - Unique Identifier (UID) given to your device during the pre-registration process.  This number is stored in the .conf file used by the Weaved daemon for this connection.\n**expirationsec**- How many seconds until this proxy address expires.  This will depend on your account service level.\n**imageintervalms** - ??\n**proxy** the returned proxy URL which you can use for connection, e.g. : \"http://proxy4.yoics.net:31067\".  The format of the proxy string will depend on the service type.\n**requested** - time that the request was received by the server\n**status** - the returned proxy URL, when \"wait\"is set to \"true\"\n**streamscheme** - ??\n**streamuri** - ??\n**url** - ??","excerpt":"Make a proxy connection to the daemon associated with this UID.   A valid login token is required.","slug":"deviceconnect","type":"endpoint","title":"/device/connect"}

post/device/connect

Make a proxy connection to the daemon associated with this UID. A valid login token is required.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

deviceaddress:
string
Weaved UID of target daemon
hostip:
string
Public IP address of sender
wait:
boolean
Whether or not to wait until the connection completes

Examples


Result Format


Documentation

You will need to supply the token received from a valid login using the /user/login call. This call makes a connection through Weaved's proxy server to the service, given the UID. **deviceaddress** - Unique Identifier (UID) given to your device during the pre-registration process. This number is stored in the .conf file used by the Weaved daemon for this connection. **expirationsec**- How many seconds until this proxy address expires. This will depend on your account service level. **imageintervalms** - ?? **proxy** the returned proxy URL which you can use for connection, e.g. : "http://proxy4.yoics.net:31067". The format of the proxy string will depend on the service type. **requested** - time that the request was received by the server **status** - the returned proxy URL, when "wait"is set to "true" **streamscheme** - ?? **streamuri** - ?? **url** - ??

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}