Telldus Live API and API explorer
Posted: Fri Mar 17, 2023 9:45 am
Hi,
I'm currently trying to get started with programming an application using the Telldus Live API, but I really cant seem to find much info on how to program. There is the one php example located at "http://api.telldus.com/documentation/phpLive", which I managed to set up and got running after some problems. Now, if I look at the code there I understand the example of how to list user clients, but I dont understand this line:
in the example with listing devices. How do I know as a programmer to put that line there from just looking at the API explorer page http://api.telldus.com/explore/clients/list ? It doesnt say anything about TELLSTICK_TURNON there. Or is there a more detailed API somewhere which I havent managed to find?
Just for u to get what I'm getting at I'm gonna take another example. Lets say I wanna list all sensors associated with the current user. So I go to the page http://api.telldus.com/explore/sensors/list to see how to do that and cant really figure out much more than that there should probably be some parameter "includeIgnored" somehow set to 1 in the params array. So.. a wild guess is it should look something like:
Hope you get what I'm getting at.. I simply cant find much info on how to program using the Telldus Live API since I cant really understand the API.. :S Is there any place where people have shared some more php examples on how to use this API?
I'm currently trying to get started with programming an application using the Telldus Live API, but I really cant seem to find much info on how to program. There is the one php example located at "http://api.telldus.com/documentation/phpLive", which I managed to set up and got running after some problems. Now, if I look at the code there I understand the example of how to list user clients, but I dont understand this line:
Code: Select all
$params = array(
'supportedMethods' => constant('TELLSTICK_TURNON') | constant('TELLSTICK_TURNOFF'),
);in the example with listing devices. How do I know as a programmer to put that line there from just looking at the API explorer page http://api.telldus.com/explore/clients/list ? It doesnt say anything about TELLSTICK_TURNON there. Or is there a more detailed API somewhere which I havent managed to find?
Just for u to get what I'm getting at I'm gonna take another example. Lets say I wanna list all sensors associated with the current user. So I go to the page http://api.telldus.com/explore/sensors/list to see how to do that and cant really figure out much more than that there should probably be some parameter "includeIgnored" somehow set to 1 in the params array. So.. a wild guess is it should look something like:
Code: Select all
?><p><a href="index.php?listSensors">List sensors</a></p><?php
if (isset($_GET['listSensors'])) {
$consumer = new HTTP_OAuth_Consumer(constant('PUBLIC_KEY'), constant('PRIVATE_KEY'), $_SESSION['accessToken'], $_SESSION['accessTokenSecret']);
$params = array(
'includeIgnored' => ???something with setting param to 1???
);
$response = $consumer->sendRequest(constant('REQUEST_URI').'/sensors/list', $params, 'GET');
echo '<pre>';
echo( htmlentities($response->getBody()));
}