Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PHP – Paladins API issue to create session

I would like to use Paladins API to make a stats website but when I send a http request to create a session I get this error as answere from the API :

string(113) "{"ret_msg":"Exception while processing: Invalid date format","session_id":"","timestamp":"7\/6\/2022 3:49:56 PM"}"

The problem seems to be timestamp parameter. For sure I looked at API documentation but no further information on what to put as timestamp :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

I’ve tried several timestamp but still stucked here. Note that I can successfully ping the API so thats not a server issue :
string(99) ""PaladinsAPI (ver 0.0.41.17634) [PATCH - 5.4] - Ping successful. Server Date:7\/6\/2022 4:05:18 PM""

Here is my code :

$ping = file_get_contents("https://api.paladins.com/paladinsapi.svc/pingJson");
var_dump($ping);

$createSession = file_get_contents("https://api.paladins.com/paladinsapi.svc/createsessionJson/myDevId/myDevPaswd/".strval(time()));
var_dump($createSession);

So here is my question : do someone already used this API and/or know what’s wrong with my code ? or do someone know what to put as timestamp parameter to make my request work ?

>Solution :

I looked at API documentation but no further information on what to put as timestamp

Are you sure about this? The example API call included on page 18 of this document shows explicitly how this is expected to be formatted, which is yyyyMMddHHmmss.

Using the format identifiers on PHP: DateTime::format, you could do something along the lines of:

$api = file_get_contents("https://api.paladins.com/paladinsapi.svc/createsessionJson/myDevID/myDevPaswd/".date("YmdHis"));
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading