On occasion you may need to verify that the API connection with the server is still valid.
You can verify server API connections with the JSON-RPC interface only.
Two methods are available, one requires a token and the other does not:
Perform a Server Verification, Passing a Token
Method name:
noop
Uses a valid token to verify the server connection. The request does nothing but return the operation that you pass.
You can also use this method to determine if your token is still valid.
Verify Using Named Parameters
Pass an operation:
JSON
1{2 "method": "noop",3 "id": 1,4 "params": {5 "token": "5636f162-8eee-4d30-a5c7-bb65fd6da2ab",6 "operation": "test"7 },8 "jsonrpc": "2.0"9}
Don’t pass an operation:
JSON
1{2 "method": "noop",3 "id": 2,4 "params": {5 "token": "5f743f54-5164-46bc-929a-cf9b55a282ff"6 },7 "jsonrpc": "2.0"8}
Verify Using Positional Parameters
Positional parameters must be applied in the same order shown in the named parameters sample.
Pass an operation:
JSON
1{2 "method": "noop",3 "id": 1,4 "params": [5 "5636f162-8eee-4d30-a5c7-bb65fd6da2ab",6 "test"7 ],8 "jsonrpc": "2.0"9}
Don’t pass an operation:
JSON
1{2 "method": "noop",3 "id": 3,4 "params": [5 "5f743f54-5164-46bc-929a-cf9b55a282ff"6 ],7 "jsonrpc": "2.0"8}
Parameter Descriptions
Parameter Name | Type | Description |
---|---|---|
token | str | Valid token from a call to login (JSON-RPC interface) or /account/login (HTTP interface). See Log In Using JSON-RPC and Log in Using the HTTP Interface, respectively. |
operation | any type | Optional A “dummy” operation to pass. You can pass any value. Defaults to ‘pong’. |
Return Codes
0
: success-10001
: invalid token
For a list of error codes not specific to
noop
, see Global Error Codes.Response Data
On success returns an object with the following data:
- code: (int) return code
- operation: (str) operation passed to the method, or defaulted by the method
Example:
1{2 "code": 0,3 "operation": "test"4}
On failure returns an object like the following, with code set to the appropriate value described in Return Codes:
1{2 "code": -100013}
Python Sample Requests
Pass a string for the operation parameter:
Python
1>>> api.noop(token, 'operation')2{u'operation': u'operation', u'code': 0}
Call the method, not passing an operation:
Python
1>>> api.noop(token)2{u'operation': u'pong', u'code': 0}
Additional Information
See any of the following sections for related information:
- Logging in, and setting a token expiry while logging in: Log In Using JSON-RPC and Log in Using the HTTP Interface, respectively.
- Setting a token expiry after logging in: Set Your Token’s Expiry.
- Checking your token’s age: Determine Your Token’s Age.
Perform a Server Verification, Not Passing a Token
Method name:
ping
Verifies the server connection. Does not require a token. The request does nothing but return the provided operation.
Verify Using Named Parameters
Pass an operation:
JSON
1{2 "method": "ping",3 "id": 1,4 "params": {5 "operation": "test"6 },7 "jsonrpc": "2.0"8}
Don’t pass an operation:
JSON
1{2 "method": "ping",3 "id": 2,4 "params": {},5 "jsonrpc": "2.0"6}
Verify Using Positional Parameters
Pass an operation:
JSON
1{2 "method": "ping",3 "id": 1,4 "params": {5 "operation": "test"6 },7 "jsonrpc": "2.0"8}
Don’t pass an operation:
JSON
1{2 "method": "ping",3 "id": 3,4 "params": [],5 "jsonrpc": "2.0"6}
Parameter Descriptions
Parameter Name | Type | Description |
---|---|---|
operation | any type | Optional A “dummy” operation to pass. You can pass any value. Defaults to ‘pong’. |
Return Codes
0
: success
For a list of error codes not specific to
ping
, see Global Error Codes.Response Data
On success returns an object with the following data:
- code: (int) return code
- operation: (str) operation passed to the method, or defaulted by the method
Example:
JSON
1{2 "code": 0,3 "operation": "4"4}
Python Sample Requests
Pass a number for the operation parameter:
Python
1>>> api.ping(4)2{u'operation': 4, u'code': 0}
Call the method, not passing an operation:
Python
1>>> api.ping()2{u'operation': 'pong', u'code': 0}