How do i tell the API command /sensor/info what sensor?

Moderator: Telldus

Post Reply
wyp0x
Posts: 2
Joined: Thu Jan 18, 2018 11:08 am

How do i tell the API command /sensor/info what sensor?

Post by wyp0x » Thu Jan 18, 2018 11:08 am

I'm trying to do my own javascript that collects data from my temp. sensors. But i don't know how to write to tell the API what sensor it should get the data from. For example on line 40. Could someone please tell me how it should be done. I'm not totally new to Java but i'm not a pro. :lol:

Code: Select all

34	
35      OAuthRequest lobj_Request1 = new OAuthRequest(Verb.GET, "http://api.telldus.com/xml/sensors/list");
36      lobj_OAuthService.signRequest(lobj_AccessToken, lobj_Request1);
37      Response lobj_Response1 = lobj_Request1.send();
38      
39    
40      OAuthRequest lobj_Request2 = new OAuthRequest(Verb.GET, "http://api.telldus.com/explore/sensor/info");
41      lobj_OAuthService.signRequest(lobj_AccessToken, lobj_Request2);      
42      Response lobj_Response2 = lobj_Request2.send();
43                       
44    
45      System.out.println("Public Key: " + publicKey); //This line is only for testing purpose
46      System.out.println("Private Key: " + privateKey); //This line is only for testing purpose
47      System.out.println("Public Token: " + publicToken); //This line is only for testing purpose
48      System.out.println("Secret Token: " + secretToken); //This line is only for testing purpose
49      System.out.println("Lista över sensorer: " + lobj_Response1.getBody());
50      System.out.println("Sensorn värde: " + lobj_Response2.getBody());
51      
52         }
53       }

tridy
Posts: 20
Joined: Thu Jan 18, 2018 11:08 am
Location: Stockholm, Sweden

Re: How do i tell the API command /sensor/info what sensor?

Post by tridy » Thu Jan 18, 2018 11:08 am

I am not sure how you would do that in JS, but take a look at the API Explorer
http://api.telldus.com/explore/sensors/list
where you call the method and it will return all the sensors info.
Try looking at the requests from Fiddler and then see what additional info it sends with the request and you simulate the request in JS.
[tridy]

Post Reply