Generate a Secure JavaScript Key

Find out what you can do with our API...


API method to use: javascript_key

Skip to demo

Description


Returns a secure key which can be used in your web pages to provide client-side access to T2A methods using JavaScript (and usually JSON).

Mandatory Parameters


Name Description
api_key Use your API key. Note that this method may only be invoked server-side.
domain Enter your domain (the request host parameter) on which the temporary Javascript key will be used.
lifetime_minutes The lifetime of the key; the maximum is 60 minutes.

Optional Parameters


Name Description
ip_address The remote IP address of the final user; if specified, the JavaScript key will only function for this IP address.
method_list

A list of method names, each separated by a comma.

When one or more methods are specified, the session key will only work for the specified method(s).

If an attempt is made to use the session key, for a method that is not in the list, the new error code method_not_permitted is returned.

Note that a new node, method_list, is added to the response, listing the method(s) specified for use by this session key.

Returned Values


The XML response is contained within a <javascript_key_res> element.

Name Description
status Returns ok if the operation has succeeded, or error if an error has occurred; Returns the error_code for error details.
error_code Returns the error code when the status is error. See below for error codes.
t2a_version_number The current API version number.
credit_used The number of credits used in order to execute the request.
javascript_key The key which can now be used with client-side JavaScript, to connect to our servers. Note that this key is alphanumeric, plus the _ and - characters.
method_list List of string types, this being a list of methods for which the session key will function, when specified.

Error Codes


See the common error codes. There are no errors which are specific to this method.

Example XML Response



<?xml version="1.0"?>
<javascript_key_res>
  <mode>normal</mode>
  <status>ok</status>
  <t2a_version_number>' . 1.0.0 . '</t2a_version_number>
  <javascript_key>dS4g8CEZo_fpOGHGx7R_OUFksg5FBnuFXpgpFWhoatCF5kKk0ydZHSS3DtrP6iPtQMT0who7GgoQ362RQVxERtT</javascript_key>
</javascript_key_res>