This object is in archive! 

Local mode API ?

DaBoss shared this question 11 years ago
Answered

Hi zipateam !


I discovered the link to API in the dashboard . . . and tested some requests . . .


It's seems working when requesting to the cloud (my.zipato.com) but not working in local . . . "Not Authenticated" message appeared.


I try to use http://localip:8080/zipato-web/rest/user/login?username=XXX&token=XXXX but the API seems not implemented totaly ?


Could you make me on the right way ?


Thanks . . .

Best Answer
photo

There will be firmware update which will fully support our API in local mode. You will be informed about that.

For now you shouldn't use it in local mode.

Replies (47)

photo
1

You need to add "&method=SHA1" at the end of your URL ;)

photo
1

Thanks for this answer.


Your answer don't help me . . . but . . . i successed with cloud url.

I get the nonce string to make the good token using SHA1 (with php)


Despite, i could not do the same directly to the zipabox in local mode.


/zipato-web/rest/user/init ou ../login return :

404 Not Found

No context found for request


When i tryed /zipato-web/rest/rooms/ it's return a "Not Authenticated" . . .


???

photo
1

HI,


Same for me, i successed to login with cloud url by gerating the right token but not at all in local mode : error 404.

photo
1

Hello,


try with the code I already posted here. http://community.zipato.com/responses/add-charts-to-meters It works like a charm since 1-2 months

photo
1

There will be firmware update which will fully support our API in local mode. You will be informed about that.

For now you shouldn't use it in local mode.

photo
1

when? this is a great option considering the last server issue. How does the android app work via local connection then? This would certainly make a much faster response time for controlling devices, I look forward to its release

photo
photo
1

Nenad,


So i will make my test with could API for the moment . . . .


Thanks for this inormation . . .

photo
1

Any update about that? Im insterested in local mode

photo
1

I tried to use the local API with the new firmware but it doesn't work...

When do you plan it ?

photo
2

I get it work.

I just changed a bit my code but it is very similar :

First step is the same to get id etc etc. The second step is:

  1. $data_url = "?method=SHA1&username=$username&password=$pass";
  2. $authen = 'http://192.168.0.245:8080/zipato-web/json/Login'.$data_url;
  3. $ch1 = curl_init($authen);
  4. curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
  5. curl_setopt($ch1, CURLOPT_COOKIE, 'JSESSIONID='.$id);
  6. curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
  7. $output = curl_exec($ch1);

Hope it helps. Basically instead of sending data in the post I pass it in the URL.

photo
1

actually it works partially. It seems some API are not yet fully functionnal

photo
1

Hi Thijs,


I've already read this thread ...

According to discussion with Tech Support, there was an issue that has been fixed for next firmware.


Thanks,

photo
1

any news?

photo
2

any updates, its now 1 year further

photo
1

In fact, it does not work yet on ZipaMini ...

photo
3

Any update?

photo
1

Will local mode available in v1.0?

photo
1

Is there any progress for having the API locally? just stopped an ordr for the boxes and modules after discovered there is no local interface.

photo
1

there is a local login mode, and the Zipabox itself can run locally only if needed, it will run rules and scenes and lighting controls, but rules that use external servers such as weather stations will obviously not work. But to edit rules, add devices and a ton of other usefull features like push notifications, etc you will need to be connected to the internet. You can also access the api if you want to here https://my.zipato.com/zipato-web/api/

photo
1

Has the local API been implemented yet? I tried using http://[local IP]:8080/zipato-web/v2/user/login and got a failed logon, but the same code works on the my.zipato.com site.

photo
1

Same here... can't login to local URL, always got an 404.


I´d really like to use the non-universal iPhone-App on my iPad but in offline/local mode only, but i don't know in what i´ve to change the Server URL in the settings!?

furthermore every help i found was´t answered yet, so please can someone help?

photo
2

Hey guys. I made a .NET SDK around the Zipato API and now it works with the Remote and Local API. The Local API is listening on http://<ip>:8080/v2 . The API methods are the same. However, I noticed that the JSON results might differ. The Local API returns less data. The JSON structure is the same, but some elements are missing.


Note that the remote api uses HTTPS while the local one uses HTTP on port 8080.


My .NET SDK is hosted on https://github.com/leonmeijer/Zipato.NET

photo
1

If Node.js is your bag of chips, there is a NPM module available too:


https://github.com/djoulz22/zipabox


It's not my project, but definitely worth to mention in this thread :)

photo
1

awesome :) thanks for that.

photo
photo
1

Does it handle the session the same? I don't seem to get back the jsessionid and the nonce the same way in the JSON when I init/logon through the Local API.

photo
1

Yes the session initialization is the same between local and remote on the http://ip:8080/v2 endpoint. Remember to use HTTP without S.

photo
1

Thanks for the affirmation. I dug deeper and found that the status code on an attribute put is a 200 using the local api and a 202 using the web api. That was throwing my code off.

photo
1

I used to connect to zipato remotely with php code, it works perfectly, but with local connection (http://ip:8080/v2) I get invalid username or password. The code is the same, only url differ...


help...

photo
1

here is the test code :


$url= "http://192.168.1.24:8080/v2";

$user = "my user";

$passw = "my passw";


$json = json_decode(file_get_contents($url."/user/init"));

$jid= $json->{'jsessionid'};

$nonce = $json->{'nonce'};

$token = sha1($nonce.sha1($passw));


print_r($json)."\n";


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url."/user/login?username=".$user."&token=".$token);

curl_setopt($ch, CURLOPT_COOKIE, 'JSESSIONID='.$jid);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


$output = curl_exec($ch);

curl_close($ch);

print_r($output)."\n";


With remote access (https://my.zipato.com:443....") I manage to connect with result :

"success" : true,

"jsessionid" : "FBA2F9533539038A39836FFA08CA4290-n1.frontend2",


but the same code with local addresse, give :

"error" : "No such username or bad password",

"jsessionid" : "ltD7KvzmimxyZBljkPpZAm2dSryLwfP9",

"nonce" : "K6YZ6eArnKArAp19xyxZL4wveE6mza4n",

"success" : false


the jsessionid is different. may be the init failed ?

photo
1

use: http://ip:8080/zipato-web/v2/user/init


as url

Which gives you nonce. Keep the jsession id and nonce in cookie and proceed with further proceedings.

photo
1

Not better with this url, I got the same error.

nonce is not needed in cookie, and if you place it in cookie, it doesn't work with classic https:443 url neither

photo
1

I get the nonce an jsessionid with /user/init, that part works, but the /user/login doesn't. I can't figure out why.


user/init :

(

[jsessionid] => vwwxVSVLzz9Qwqmg1kq9IgBy1Zo3iX17

[nonce] => snOZ1lNtwNJlidJciGrzMXOvehgdYugi

[success] => 1

)


login :

{

"error" : "No such username or bad password",

"jsessionid" : "vwwxVSVLzz9Qwqmg1kq9IgBy1Zo3iX17",

"success" : false

}

httpCode : 200

photo
1

Is there a way to test local connection directly without coding ?

photo
1

What is the firmware version of Zipabox.

We have developed a whole mobile app. using the zipato local API.

photo
2

I would be interested in seeing this app. If you need any ideas for app development I highly recommend Jacob Wiqvisk, he had some great ideas.

Also check out the Zipato android app discussion board on Google+.

Will this app be availble for all platforms, IOS, android and Windows?

photo
photo
1

The firmware is 1.0.21 (latest official I think).

It's very starnge, works prefectly remotely, but no connection localy, whatever url I use.

photo
1

Can you please give us the procedure to login remotely using API

photo
photo
1

BTW, don't forget that URL needs to be encoded, so username account with @ should be translated to %40

photo
1

Thought about it already, it changes nothing

photo
1

have you emailed support and asked them? surely they could help. The more apps out there the better, it shows that Zipato is a widely supported and developing system.

photo
1

I just opened a ticket with my issue. Just have to wait now... if I get an answer

photo
1

Here the answer from support :


"I'm sorry but we cannot help you with this issue.


Local connection is currently not available for users."


closed...

photo
1

That is strange, especially that I'm using it since more than a year.

photo
1

i think what they mean is that local api is not available, not local connection.

photo
1

Nope !

I'm using LocalAPI with local connection since more than a year ...

photo
1

It works for me.


1. run init: http://yourip:8080/zipato-web/v2/user/init

2. Parse JSESSIONID and nonce

3. Create token. SHA-1

4. Do a login with http://yourip:8080/zipato-web/v2/user/login?username=yourusername&token=yourtoken

Don't forget to set JSESSIONID in the header. setHeader("Cookie", "JSSESIONID=xxxx")


5. Set the JSESSIONID in the header for each call to the zipabox.


Is the token created correctly?


I do this in Java:


combined = nonce + hashToken (I think its my password hashed)

token = Hex.encodeHexString(sha1.digest(combined))

photo
2

I do the same but in php.

but I think the init goes wrong, because JSESSIONID do not look the same at all.

on local I have json like :

{

[jsessionid] => wCIE81PR0cJ9MhjzF2EgtXXcKk9ABR3d

[nonce] => SHlRmAwQj0pKaMUropvW6qJeOoIa0MUf

[success] => 1

}


and remotely :

{

[success] => 1

[jsessionid] => 0979C178CE1915A95CDCC4E994481A6A-n1.frontend5

[nonce] => MkhmEdoPlZdkkDzG

}


and firmware is 1.0.21

photo
1

@sguyomard: Did you manage to resolve this issue?

From your descriptions in this thread I believe I have the same issue, and would be happy to see if you have found out anything more on this.

photo
1

found a working solution :


connect to thombox/zipabox locally

==================================


first issue init request (GET)

================

http://<local_ip>:8080/zipato-web/json/init


in response you get :

{

"jsessionid": "xDLY2.....",

"nonce": "LVag......v",

"success": true

}


second issue login request (GET)

==========================

format token using test.js :

code with node.js

_______________________________________________

var crypto = require('crypto');


var password = 'your password';

var nonce = 'nonce received at init';


function sha1( data ) {

var generator = crypto.createHash('sha1');

generator.update( data )

return generator.digest('hex')

}


var token = nonce + sha1(password);


console.log( sha1(token) );

_______________________________________________


token = sha1 (nounce + sha1(password));


in header add :

Content-Type:application/json

Cookie:"jsessionid=xDLY2....."


http://<local_ip>:8080/zipato-web/v2/user/login?username=name%40domain&token=<token>;


don't forget to URLencode '@' in user name if it's email address (%40)


you should get answer :

{

"success": true

}


then you're connected, and can issue requests to the box

========================================================


keep in request header :

Content-Type:application/json

Cookie:"jsessionid=xDLY2....."


http://<local_ip>:8080/zipato-web/v2/box/

(GET)

answer :

{

"serial": "....",

"name": "Demo",

"remoteIp": "X.X.X.X",

"localIp": "<local_ip>",

"timezone": "CET",

"gmtOffset": 7200000,

.....

}

photo
1

it is work,thx

photo
1

Hello.

How do I determine what IP the Zipabox (1) is on when using dynamic IP-address?

photo
1

You can simply use the Zipato for local mode api for using the dynamic IP address. For instant support related to the AT&T Email Not Working Error please contact Our team for the best solution.

photo
Leave a Comment
 
Attach a file