Not able to Login through API (JSON, SOAP)

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Post Reply
gregory
Posts: 46
Joined: Fri Oct 28, 2011 3:39 pm

Not able to Login through API (JSON, SOAP)

Post by gregory » Sun Jul 09, 2017 5:10 pm

Running 10.6.2 Community Edition on Ubuntu 16.04 with php 7.0 and mysql

Have tried both API examples for SOAP and JSON and confirmed the username and password are valid by logging in through html interface successfully.

JSON here is response:
Posting data to URL: https://xxxxcorp.dynu.net:444/xxxxTT/ap ... thod=Login POST Data: json=%7B%22user_name%22%3A%22admin%22%2C%22password%22%3A%226666666%22%7D -------------------------------------------------------------- Login Failed!

When I put URL in directly I get: {"api_retval":false,"api_details":{"code":"EXCEPTION","description":"Method Login POST Data: json={"user_name":"admin","password":"666666"} does not exist.","record_details":{"total":0,"valid":0,"invalid":0},"user_generic_status_batch_id":false,"details":false}}

SOAP I added some echo to the api scripts and get:
LOGGING IN
FAULT SOAP Fault: (Code: HTTP, String: Could not connect to host) - Request: Response: Login Failed!

In both scripts using:
$TIMETREX_USERNAME = 'admin';
$TIMETREX_PASSWORD = '666666';

For JSON
$TIMETREX_URL = 'https://xxxxcorp.dynu.net:444/xxxxTT/api/json/api.php'

For SOAP
$TIMETREX_URL = 'https://xxxxcorp.dynu.net:444/xxxxTT/api/soap/api.php'

Does anything in timetrex.ini.php affect this?

Have Log Enabled at verbosity 10 and Production FALSE, but nothing showing up in log

Thanks in advance,

Gregory

shaunw
Posts: 7360
Joined: Tue Sep 19, 2006 2:22 pm

Re: Not able to Login through API (JSON, SOAP)

Post by shaunw » Mon Jul 10, 2017 7:31 am

FAULT SOAP Fault: (Code: HTTP, String: Could not connect to host) - Request: Response: Login Failed!
That is likely your problem there, your script isn't able to communicate with the TimeTrex web server at all. Are you 100% certain the URL is correct? Is the URL using SSL?

gregory
Posts: 46
Joined: Fri Oct 28, 2011 3:39 pm

Re: Not able to Login through API (JSON, SOAP)

Post by gregory » Mon Jul 10, 2017 7:07 pm

Shaun thanks.

When you say URL which exactly are you referring to? I am sure http://xxxxcorp.dynu.net/xxxxTT/ is correct HTTP URL from outside our office and https://xxxxcorp.dynu.net:444/xxxxTT is correct HTTP URL from outside office as through either I get interface to come up.

I have tried both above followed by /soap_punchtest.php see attached and get:

For HTTP:
LOGGING IN
FAULT SOAP Fault: (Code: HTTP, String: Could not connect to host) - Request: Response: Login Failed!

FOR HTTPS with http version for the $TIMETREX_URL global in soap_punchtest.php:
LOGGING IN
FAULT SOAP Fault: (Code: HTTP, String: Could not connect to host) - Request: Response: Login Failed!

Does $TIMETREX_URL need to be relative or local?

Thanks,

Gregory
Attachments
soap_punchtest.txt
(1.24 KiB) Downloaded 10 times

shaunw
Posts: 7360
Joined: Tue Sep 19, 2006 2:22 pm

Re: Not able to Login through API (JSON, SOAP)

Post by shaunw » Tue Jul 11, 2017 7:24 am

The URL should be a fully qualified URL that is accessible from whatever device you are running the script from. Just because you use one URL from outside the office, doesn't mean the same URL will work from inside the office though, it all depends on how you have your network setup.

gregory
Posts: 46
Joined: Fri Oct 28, 2011 3:39 pm

Re: Not able to Login through API (JSON, SOAP) - SOLVED

Post by gregory » Mon Aug 21, 2017 4:01 pm

Working now in SOAP, need to set force SSL to FALSE in timetrex.ini.php as even if use https for TIMETREX_URL it fails. Works with force_SSL false and TIMETREX_URL starting with http://

shaunw
Posts: 7360
Joined: Tue Sep 19, 2006 2:22 pm

Re: Not able to Login through API (JSON, SOAP)

Post by shaunw » Tue Aug 22, 2017 7:37 am

Sounds like you have problems with your SSL setup, does SSL work from a regular web-browser for you?

gregory
Posts: 46
Joined: Fri Oct 28, 2011 3:39 pm

Re: Not able to Login through API (JSON, SOAP)

Post by gregory » Sat Sep 02, 2017 6:41 pm

Yes accessing https://url..../Timetrex/interface works fine from any computer

Post Reply