Loader

API Ping


Overview

Calling the ping command will keep your session ID active for another 15 minutes (unless it has already expired).

This command is only useful if you are using the Authentication command to get a session ID for authenticating your API requests. Session IDs expire after 15 minutes of inactivity (if no API request is made with the session ID for 15 minutes).

Note: any API command using a session ID will cause your session ID to remain active for another 15 minutes. You can call this API command once every 10 minutes or so to keep your session active. Should your session expire, your application needs to make a new authentication request to get a new session ID.


Command
ping

Parameters

For this call, you do not send through the usual authentication parameters. You will only send through the session ID:

Parameter

Description

session_id

Your session ID

 
Examples

All examples below are for the document/literal based server.

1
2
3
4
5
6
7
8

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
    <SOAP-ENV:Body>
        <ns1:ping>
            <session_id>f95d64c67d1d10d17443d636e4101711</session_id>
        </ns1:ping>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Code samples

PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

>
<?php
$oClient new SoapClient(
    'http://api.clickatell.com/soap/document_literal/webservice?wsdl',
    array(
        'trace' => true,
        'keep_alive' => true
    )
);
 
// Keep session active if it has not expired already
$aResult $oClient->ping(
    array(
        'session_id' => 'f95d64c67d1d10d17443d636e4101711',
    )
);
 
echo '<pre>' . print_r($aResult,true) . '</pre>';
?> 


API responses


Example response

Successful API response

1
2
3
4
5
6
7
8

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
    <SOAP-ENV:Body>
        <ns1:pingResponse>
            <return>OK:</return>
        </ns1:pingResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope


Error response

1
2
3
4
5
6
7
8

<!--?xml version="1.0" encoding="UTF-8"?-->
 
     
         
            ERR: 001, Authentication failed
         
     
  


Return format


Successful API response:

OK:


Error response:

ERR: <error code>, <error description>

 

Did you find this information informative?

Other Resources

Ask the Community

Visit Stack Overflow to join our community of developers and find the answer you need

Contact Support

Contact our support team and one of our agents will be in touch with you to answer any questions you have