API Help

Discussion for TimeTrex open source community developers.
Locked
loyiso
Posts: 10
Joined: Mon Jan 23, 2012 1:05 am

API Help

Post by loyiso »

We are trying to use the TimeTrex API to perform functions such as punch in from another web application. However we're experiencing difficulties with even the most basic functions such as Login. We've studied all the functions related to this function, and even used the api example code found in api-client-example.php and event that code doesnt work. Can someone please help. How are these API classes supposed to be used?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: API Help

Post by shaunw »

You will need to provide more details, are you getting any error messages? What version of TimeTrex are you using? What is the exact code that you are using?
loyiso
Posts: 10
Joined: Mon Jan 23, 2012 1:05 am

Re: API Help

Post by loyiso »

We're using v5.0.4.

Ok first, our main aim is to facilitate punching from another web application. We figure this cant be done without a loggin in and an active session. So, using the example shown in api-client-example.php, we created the TimeTrexClientAPI object using the default constructor. So the Login function defined in the TimeTrexClientAPI has the following call:

$retval = $this->getSoapClientObject()->Login( $user_name, $password, $type );

The function 'getSoapClientObject()' returns a Soap Client as it should, but when calling the Login function from THAT Soap Client the returned value is an array. Therefore $retval becomes an array. Now one assumes that the Soap Client object has 'Login' function defined, but we cannot seem to find where the Soap Client class is defined so we can have a look at why 'Login' returns an array.

Im sure there's no need to mention that 'Login' of the TimeTrexClientAPI class performs a check to see if $retval is not and array in order to return TRUE.

I hope this helps.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: API Help

Post by shaunw »

We would need to see your entire code to offer any suggestions as you haven't given us any actual error messages or anything else to really go on.

You should be able to modify the URL/username/password at the top of the api/soap/api_client_example.php file and run it and it should work fine.
Locked