token or apikey missing

Posted in General by Dame Bliznak Mon Mar 07 2016 16:41:18 GMT+0000 (UTC)·13·Viewed 1,163 times

when i connect to it says :token or apikey missing but there is token and i use the same token to list devices and that works fine can someone help me ??
Gary Worsham
Mar 7, 2016

Please show your exact code. There are some tricks involved in getting the commands correct and these are language dependent.

Dame Bliznak
Mar 7, 2016

I'm coding in android(java),and did more than 1 variation from the code.This is one example just to test the api and see if i get the right error
url = new URL("");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Content-Type", "application/json");
urlConnection.setRequestProperty("apikey", "WeavedDemoKey$2015");
If u could help me in any way what would be great :).
Im getting the token from the first service with my user name and pass so i know it is up to date

Gary Worsham
Mar 8, 2016

Sorry I don't know the exact way to do this in Java, but you have not included:
1) deviceAddress (UID)
2) Host IP
3) Wait (boolean)

Please check the Python example. The headers and data are specified in different ways.

proxyHeaders = {
'Content-Type': content_type_header,
'apikey': apiKey,
'token': token

proxyBody = {
            'deviceaddress': UID,
            'hostip': my_ip,
            'wait': "true"

response, content = http.request( proxyConnectURL,
Dame Bliznak
Mar 8, 2016

as i know first u have to make the connection, than send the data, and if i dont have the data i should get another error , u can check this on the service on yor webpage just enter the token and dont enter data, and im getting missing token .. the second part is irrelevant at this point
and i had the data too it was the same ..IT DIDNT CONNECT ... the capital leters are just to highlight the problem nothing more

Gary Worsham
Mar 8, 2016

In bash, you have to escape the $ in the token by adding a reverse slash in front of it. Does this help?

Gary Worsham
Mar 8, 2016

Please send an e-mail with the actual token you are using to

Dame Bliznak
Mar 8, 2016

yea i know about the bash \$.. doesnt happen with java android ... didnt work on the project today... ill update it as soon as i have something new... and the token i get works,i use it to get the list of devices ,but cant get the proxy ... it may be the new httpUrlconnection from android,and im missing something from that....I wonder how long does a token last ??...

Dame Bliznak
Mar 8, 2016

and tnx for ur time and reply's

Gary Worsham
Mar 8, 2016

The token lasts "about a day" currently but it is a dynamic resource which means the more people are using the system, the shorter it lasts. Therefore, your software should always check for an expired token and renew it if necessary.

Dame Bliznak
Apr 14, 2016

sooo i tried to get the project working again ... im still getting the same mistake 401 code.... and im sure that i get the post and the tokes right , but i get the apikey mistake...
just to be clear ... i can get all the GET methods(so the token is right and operational,and the code too) but the POST method isnt working.... getting 401

Dame Bliznak
Apr 15, 2016

i got it working ... sorry for the trouble it was a mistake on my part, was sending the token value with quotation marks, my brother sow that .... sometimes u need someone else to find ur mistakes ... sorry for the trouble

Dame Bliznak
Apr 19, 2016

now i have problems with SSL certificate ... can u help me with that ??

Jeremy Newton
June 8, 2017

Dame: I recommend using an application like PostMan for trial and error with regards to connection. Most of these applications will display a "code" page where you can grab the proper snippets from your test in various languages.
For the SSL thing, are you trying to cURL from a non-SSL box? If so, there are a couple header booleans you can play with to make the systems play nice (SSL_VERIFYPEER, SSLVERIFYHOST, etc)

Markdown is allowed