Page 1 of 1

Not able to Login through API (JSON, SOAP)

Posted: Sun Jul 09, 2017 5:10 pm
by gregory
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

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

Posted: Mon Jul 10, 2017 7:31 am
by shaunw
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?

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

Posted: Mon Jul 10, 2017 7:07 pm
by gregory
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

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

Posted: Tue Jul 11, 2017 7:24 am
by shaunw
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.

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

Posted: Mon Aug 21, 2017 4:01 pm
by gregory
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://

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

Posted: Tue Aug 22, 2017 7:37 am
by shaunw
Sounds like you have problems with your SSL setup, does SSL work from a regular web-browser for you?

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

Posted: Sat Sep 02, 2017 6:41 pm
by gregory
Yes accessing https://url..../Timetrex/interface works fine from any computer