Page 1 of 1

Telldus Live API and API explorer

Posted: Fri Mar 17, 2023 9:45 am
by Ozzie
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:

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()));
}
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?

Re: Telldus Live API and API explorer

Posted: Fri Mar 17, 2023 9:45 am
by gein
To answer your first question. You are looking at the wrong APi method in the explorer. List devices is done with: http://api.telldus.com/explore/devices/list

Re: Telldus Live API and API explorer

Posted: Fri Mar 17, 2023 9:45 am
by micke.prag
supportedMethods is well documented here: http://developer.telldus.com/doxygen/

This should work (do you really want the ignored ones?):

Code: Select all

$params = array(
  'includeIgnored' => 1
);

Re: Telldus Live API and API explorer

Posted: Fri Mar 17, 2023 9:45 am
by Ozzie
@gein: true.. Posted the wrong link even though I ment yours.. ;)

@ micke.prag: From what I understand that is for the Telldus Core API and not the Telldus Live! API, so it only explains it from the C and C++ point of view. Aren't there any more examples with the PHP approach somewhere?

Re: Telldus Live API and API explorer

Posted: Fri Mar 17, 2023 9:45 am
by micke.prag
Ozzie wrote:From what I understand that is for the Telldus Core API and not the Telldus Live! API, so it only explains it from the C and C++ point of view.
The concept is the same it is just the functions that differs. Read the C/C++ documentation and a lot of the information can be applied on the Telldus Live! API as well.

If you find some piece of information missing, please contribute. Other might miss it too.