registerTextKeyUserCSA API

Description

The registerTextKeyUserCSA API call allows you to add a new user registration, modify an existing registration, delete a registration or query an existing registration. It's functions are similar to the registerTextKeyUser API call but add the ability to set the Customer Service Agency functions.


API Testing Page

To test the registerTextKeyUserCSA API Call in a fully interactive environment, click here.


Input Parameters

Name Data Type Description Required
apiKey String This is a unique key that is used to authenticate an API request. It should never be exposed. With the _Key function
command Integer Defines the type of operation to be applied to the registered user.

Option Value
Query 0
AddChange 1
Delete 2
Yes
cellNumber String The Cell Number that you are registering Yes
ownerFName String User's First Name. This parameter is only used to assist the customer's administrator. It may be blank. Yes
ownerLName String User's Last Name. This parameter is only used to assist the customer's administrator. It may be blank. Yes
suppl1 String An additional identifier chosen by the customer. Examples might be the department number, payroll ID number, etc. This parameter is only used to assist the customer's administrator. It may be blank. Yes
suppl2 String Another additional identifier chosen by the customer. Examples might be the department number, payroll ID number, etc. This parameter is only used to assist the customer's administrator. It may be blank. Yes
textKeyMode Integer The TextKey validation mode.

Option Value
TextKeyOnly 0
PinCodeOnly 1
TextKeyPlusPin 2
Anything 3
Yes
receiveMode Integer The TextKey receive mode.
The UseDefault option is valid only on registration API calls. It indicates that the option will be taken from the customer default.
Option Value
AnyCode 0
SpecificCodeDisplay 1
SpecificCodeNoDisplay 2
RandomCode 3
UseDefault 4
Yes
pinCode String The numeric Pin Code as a string. Empty String indicates no Pin Code. Yes
distressPinCode String The numeric Distress Pin Code as a string. Empty String indicates no Distress Pin Code. Yes
ownerBirthDate String The users birth date. The format should be MM/DD/YYYY (i.e. 12/25/1984). Yes
ownerGender String The users gender. The values should be either M or F. Yes
q1 String The first user profile question. Yes
a1 String The answer to the first user question. Yes
q2 String The second user profile question. Yes
a2 String The answer to the second user question. Yes
q3 String The third user profile question. Yes
a3 String The answer to the third user question. Yes

Output

Name Data Type Description
action Integer Defines the type of operation applied to the registered user.

Status Returned Value
Query 0
AddChange 1
Delete 2
cellNumber String The Cell Number the operation was applied to
ownerFName String The User's First Name.
ownerLName String The User's Last Name.
suppl1 String An additional identifier chosen by the customer.
suppl2 String Another additional identifier chosen by the customer.
textKeyMode Integer The TextKey validation mode.

Status Returned Value
TextKeyOnly 0
PinCodeOnly 1
TextKeyPlusPin 2
Anything 3
receiveMode Integer The TextKey receive validation mode.

Status Returned Value
AnyCode 0
SpecificCodeDisplay 1
SpecificCodeNoDisplay 2
RandomCode 3
UseDefault 4
pinCode String The numeric Pin Code.
distressPinCode String The numeric Distress Pin Code.
ownerBirthDate String The users birth date. The format should be MM/DD/YYYY (i.e. 12/25/1984).
ownerGender String The users gender. The values should be either M or F.
q1 String The first user profile question.
a1 String The answer to the first user question.
q2 String The second user profile question.
a2 String The answer to the second user question.
q3 String The third user profile question.
a3 String The answer to the third user question.

REST Example

RESTful URL

The TextKey Restful interface consists of the secure URL path followed by the appropriate CommandName.

For instance:

https://secure.textkey.com/REST/TKRest.asmx/CommandName

The CommandName is the API call itself which in this case is registerTextKeyUserCSA.

Here is what the complete URL for this API call would look like:

https://secure.textkey.com/REST/TKRest.asmx/registerTextKeyUserCSA

All Restful calls must be made using the POST method and should be of the content type application/json.

Here is an example of what a request header should look like:

POST /REST/TKRest.asmx/registerTextKeyUserCSA HTTP/1.1
Host: secure.textkey.com
Accept: */*
Content-Type:application/json
Content-Length: 584

JSON Input Payload

All TextKey Restful service commands take a JSON object as the input and return a JSON object as the resulting payload. Authentication is handled via an API key as one of the parameters in the JSON input.

The JSON Input payload for the registerTextKeyUserCSA API call should look something like this:

{
    "DataIn": {
        "apiKey": "9021fa44-f1bc-4590-b975-42fee031e078",
        "command": "Query",
        "cellNumber": "8181231234",
        "ownerFName": "",
        "ownerLName": "",
        "ownerBirthDate": "",
        "ownerGender": "M",
        "suppl1": "",
        "suppl2": "",
        "userID": "",
        "isHashed": "true",
        "pinCode": "",
        "distressPinCode": "",
        "q1": "",
        "a1": "",
        "q2": "",
        "a2": "",
        "q3": "",
        "a3": "",
        "TextKeyMode": "TextKeyOnly",
        "ReceiveMode": "AnyCode"
    }
}

JSON Output Payload

The JSON response should look something like this:

JSON Response with a valid payload
{
    "d":{
        "__type":"TextKeyCommon.TKStructures+RegisterTextKeyUserCSAReturn",
        "action":"0",
        "cellNumber":"8181231234",
        "ownerFName":"Stan",
        "ownerLName":"Steamer",
        "suppl1":"No",
        "suppl2":"Yes",
        "userID":"Stan",
        "textKeyMode":0,
        "receiveMode":0,
        "pinCode":"123",
        "distressPinCode":"1234",
        "ownerBirthDate":"12/25/1984",
        "ownerGender":"M",
        "q1":"q1",
        "a1":"a1",
        "q2":"q2",
        "a2":"a2",
        "q3":"q3",
        "a3":"a3",
        "errorDescr":""
    }
}
__type: TextKeyCommon.TKStructures+RegisterTextKeyUserCSAReturn
action: 0
cellNumber: 8181231234
ownerFName: Stan
ownerLName: Steamer
suppl1: No
suppl2: Yes
userID: Stan
textKeyMode: 0
receiveMode: 0
pinCode: 123
distressPinCode: 1234
ownerBirthDate: 12/25/1984
ownerGender: M
q1: q1
a1: a1
q2: q2
a2: a2
q3: q3
a3: a3
errorDescr: 

OR

JSON Response with an error
{
    "d":{
        "__type":"TextKeyCommon.TKStructures+RegisterTextKeyUserCSAReturn",
        "action":null,
        "cellNumber":null,
        "ownerFName":null,
        "ownerLName":null,
        "suppl1":null,
        "suppl2":null,
        "userID":null,
        "textKeyMode":0,
        "receiveMode":0,
        "pinCode":null,
        "distressPinCode":null,
        "ownerBirthDate":null,
        "ownerGender":null,
        "q1":null,
        "a1":null,
        "q2":null,
        "a2":null,
        "q3":null,
        "a3":null,
        "errorDescr":"Invalid Login"
    }
}
Error: Invalid Login.

REST Code Examples

PHP

Example 1 - Using the TextKey PHP Helper Library

The simplest way to use TextKey REST API calls, is to include the TextKey REST Helper Library and then use the TextKey object to handle all of the heavy lifting.

You will be returned a PHP object and can reference all of the payload values directly from that object.

// Include the TextKey classes
include_once("textkey_rest.php");

// Setup the API call parameters
$Command = "Query";
$CellNumber = "8181231234";
$OwnerFName = "";
$OwnerLName = "";
$Suppl1 = "";
$Suppl2 = "";
$RegUserID = "";
$isHashed = TRUE;
$PinCode = "";
$DistressPinCode = "";
$TextKeyMode = "TextKeyOnly";
$ReceiveMode = "AnyCode";
$Ownerbirthdate = "";
$Gender = "";
$q1 = "";
$a1 = "";
$q2 ="";
$a2 = "";
$q3 = "";
$a3 = "";

// Set the authentication
$apikey = "9021fa44-f1bc-4590-b975-42fee031e078";

// Create a TK object
$tk = new textKey($apikey);

// Handle the operation
$textkey_result = $tk->perform_registerTextKeyUserCSA($Command, $CellNumber, $OwnerFName, $OwnerLName, $Suppl1, $Suppl2, $Ownerbirthdate, $Gender, $RegUserID, $isHashed, $PinCode, $DistressPinCode, $q1, $a1, $q2, $a2, $q3, $a3, $TextKeyMode, $ReceiveMode);

// Handle the results
if ($textkey_result->errorDescr == "") {
  $tkResultsArr = get_object_vars($textkey_result);
	$results = "";
  foreach($tkResultsArr as $key => $value) { 
    $results .= $key . ': ' . $value . "<BR>";
  } 			
  echo $results;
}
else {
  $results = 'Error: ' . $textkey_result->errorDescr . "<BR>";
  echo $results;
}

Here is an example of the PHP object returned:

stdClass Object
(
    [__type] => TextKeyCommon.TKStructures+RegisterTextKeyUserCSAReturn
    [action] => 
    [cellNumber] => 
    [ownerFName] => 
    [ownerLName] => 
    [suppl1] => 
    [suppl2] => 
    [userID] => 
    [textKeyMode] => 0
    [receiveMode] => 0
    [pinCode] => 
    [distressPinCode] => 
    [ownerBirthDate] => 
    [ownerGender] => 
    [q1] => 
    [a1] => 
    [q2] => 
    [a2] => 
    [q3] => 
    [a3] => 
    [errorDescr] => 
)
Example 2 - Using the REST API Call directly

In order to use the TextKey REST API calls directly, you will need to setup the API payload using the appropriate parameters and the API key formatted as a JSON string and then make a CURL POST request.

The POST header does need to be setup as a JSON request (i.e. an application/json header) or you will not get a response.

You will be returned a JSON string as the API call payload. That can be converted into a PHP object using the json_decode call.

// TextKey REST path
define('TK_REST', 'https://secure.textkey.com/REST/TKRest.asmx/');

// Setup the API call parameters
$Command = "Query";
$CellNumber = "8181231234";
$OwnerFName = "";
$OwnerLName = "";
$Suppl1 = "";
$Suppl2 = "";
$RegUserID = "";
$isHashed = TRUE;
$PinCode = "";
$DistressPinCode = "";
$TextKeyMode = "TextKeyOnly";
$ReceiveMode = "AnyCode";
$Ownerbirthdate = "";
$Gender = "";
$q1 = "";
$a1 = "";
$q2 ="";
$a2 = "";
$q3 = "";
$a3 = "";

// Set the authentication
$apikey = "9021fa44-f1bc-4590-b975-42fee031e078";

// Build the REST API URL
$url = TK_REST . 'registerTextKeyUserCSA';

// Setup data
$postdata = json_encode(
	array('DataIn' => 
		array(
			'apiKey' => urlencode($apikey),
			'command' => urlencode($Command),
			'cellNumber' => urlencode($CellNumber),
			'ownerFName' => urlencode($OwnerFName),
			'ownerLName' => urlencode($OwnerLName),
			'suppl1' => urlencode($Suppl1),
			'suppl2' => urlencode($Suppl2),
			'userID' => urlencode($RegUserID),
			'isHashed' => urlencode($isHashed?"true":"false"),
			'pinCode' => urlencode($PinCode),				
			'ownerBirthDate' => urlencode($Ownerbirthdate),				
			'ownerGender' => urlencode($Gender),				
			'q1' => urlencode($q1),				
			'a1' => urlencode($a1),				
			'q2' => urlencode($q2),				
			'a2' => urlencode($a2),				
			'q3' => urlencode($q3),				
			'a3' => urlencode($a3),				
			'distressPinCode' => urlencode($DistressPinCode),				
			'distressPinCode' => urlencode($DistressPinCode),				
			'TextKeyMode' => urlencode($TextKeyMode),				
			'ReceiveMode' => urlencode($ReceiveMode)			
		)
	),
JSON_PRETTY_PRINT);

// Handle the API request via CURL
$curl = curl_init($url);

// Set the CURL params and make sure it is a JSON request
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);  // Wildcard certificate

$response = curl_exec($curl);
curl_close($curl);

// Handle the payload
$textkey_payload = json_decode($response);
if ($textkey_payload->d) {
	$textkey_result = $textkey_payload->d;
}
else {
	$textkey_result = $textkey_payload;
};

// Handle the results
if ($textkey_result->errorDescr == "") {
  $tkResultsArr = get_object_vars($textkey_result);
	$results = "";
  foreach($tkResultsArr as $key => $value) { 
    $results .= $key . ': ' . $value . "<BR>";
  } 			
  echo $results;
}
else {
  $results = 'Error: ' . $textkey_result->errorDescr . "<BR>";
  echo $results;
}

JAVA

Example - Using the TextKey JAVA Helper Library

The simplest way to use TextKey REST API calls, is to include the TextKey REST Helper Library and then use the TextKeyRest object to handle all of the heavy lifting.

You will be returned a JSON string.

package com.textkey.rest.examples;

import org.json.JSONObject;
import com.textkey.rest.TextKeyRest;

public class TestRegisterTextKeyUserCSA {

	public static void main(String[] args) {
		/* Setup */
		String TK_API = "9021fa44-f1bc-4590-b975-42fee031e078";
		  
		/* Create the TextKey object */
		TextKeyRest textkey = new TextKeyRest(TK_API, false);
		
		/* Setup the API call parameters */
		Integer Command = 1;
		String CellNumber = "8181231234";
		String OwnerFName = "Stan";
		String OwnerLName = "";
		String Suppl1 = "Suppl1";
		String Suppl2 = "Suppl2";
		String ownerBirthDate = "01/01/1970";
		String ownerGender = "M";
		String UserID = "Stan";
		String isHashed = "TRUE";
		String PinCode = "1234"; 
		String DistressPinCode = "4321";
		String q1 = "Question 1";
		String a1 = "Answer 1";
		String q2 = "Question 2";
		String a2 = "Answer 2";
		String q3 = "Question 3";
		String a3 = "Answer 3";
		Integer TextKeyMode = 0;
		Integer ReceiveMode = 0;

		/* Make the REST API Call */
		String JSONpayload =  textkey.perform_registerTextKeyUserCSA(Command,
														             CellNumber, 
														             OwnerFName, 
														             OwnerLName, 
														             Suppl1, 
														             Suppl2,
														             ownerBirthDate,
														             ownerGender,
														             UserID, 
														             isHashed, 
														             PinCode, 
														             DistressPinCode, 
														             q1,
														             a1,
														             q2,
														             a2,
														             q3,
														             a3,
														             TextKeyMode, 
														             ReceiveMode);

		/* Display the API Results */
		try {
			JSONObject results = new JSONObject(JSONpayload).getJSONObject("d");
		    System.out.println("Test Results: \n" + TextKeyRest.toPrettyFormat(results.toString()));
		} catch(Exception pe){
			pe.printStackTrace();
		} 				
	}

}

Here is an example of the JSON string with the d wrapper removed:

Test Results: 
{
  "receiveMode": 0,
  "q2": "Question 1",
  "q1": "Question 2",
  "q3": "Question 3",
  "ownerGender": "M",
  "cellNumber": "8051231234",
  "ownerLName": "",
  "distressPinCode": "4321",
  "__type": "TextKeyCommon.TKStructures+RegisterTextKeyUserCSAReturn",
  "ownerFName": "Stan",
  "userID": "Stan",
  "pinCode": "1234",
  "textKeyMode": 0,
  "suppl1": "Suppl1",
  "a1": "Answer 1",
  "a2": "Answer 2",
  "a3": "Answer 3",
  "suppl2": "Suppl2",
  "ownerBirthDate": "1/1/1970"
}

NOTE: For more detais on the JAVA Library object and methods, you can take a look at the online documentation at http://textpower.github.io/RESTLibrary-java/.

RUBY

Example - Using the TextKey RUBY Helper Library

The simplest way to use TextKey REST API calls, is to include the TextKey REST Helper Library and then use the TextKeyRest object to handle all of the heavy lifting.

You will be returned a JSON string.

NOTE: To install the textkey_rest gem you can run gem install textkey_rest from a command line. To build the testkey_rest gem locally, get the latest repository at github and follow the instructions.

require 'json'
require 'textkey_rest'

# Setup
apiKey = "9021fa44-f1bc-4590-b975-42fee031e078"

# Create the textkey object
textkey = TextKeyRest.new(apiKey, false)

# Setup the API parameters
command = 1
cellNumber = "8181231234"
ownerFName = "Stan"
ownerLName = ""
suppl1 = "Suppl1"
suppl2 = "Suppl2"
ownerBirthDate = "01/01/1970"
ownerGender = "M"
userID = "Stan"
isHashed = "TRUE"
pinCode = "1234" 
distressPinCode = "4321"
q1 = "Question 1"
a1 = "Answer 1"
q2 = "Question 2"
a2 = "Answer 2"
q3 = "Question 3"
a3 = "Answer 3"
textKeyMode = 0
receiveMode = 0

# Make the API Call
response = textkey.perform_registerTextKeyUserCSA(command,
												  cellNumber, 
												  ownerFName, 
												  ownerLName, 
												  suppl1, 
												  suppl2,
												  ownerBirthDate,
												  ownerGender,
												  userID, 
												  isHashed, 
												  pinCode, 
												  distressPinCode, 
												  q1,
												  a1,
												  q2,
												  a2,
												  q3,
												  a3,
												  textKeyMode, 
												  receiveMode)

# Pull out the data from the response
response_obj = JSON.parse(response)
response_data = response_obj['d']

# Display the response 
puts "TextKey Results:"
puts JSON.pretty_generate response_data

Here is an example of the JSON string with the d wrapper removed:

Test Results: 
{
  "receiveMode": 0,
  "q2": "Question 1",
  "q1": "Question 2",
  "q3": "Question 3",
  "ownerGender": "M",
  "cellNumber": "8051231234",
  "ownerLName": "",
  "distressPinCode": "4321",
  "__type": "TextKeyCommon.TKStructures+RegisterTextKeyUserCSAReturn",
  "ownerFName": "Stan",
  "userID": "Stan",
  "pinCode": "1234",
  "textKeyMode": 0,
  "suppl1": "Suppl1",
  "a1": "Answer 1",
  "a2": "Answer 2",
  "a3": "Answer 3",
  "suppl2": "Suppl2",
  "ownerBirthDate": "1/1/1970"
}

NOTE: For more detais on the RUBY Library object and methods, you can take a look at the online documentation at http://textpower.github.io/RESTLibrary-ruby/.

Javascript

All of the TextKey REST API calls are CORS compliant so they can be called via an Ajax request with no cross domain issues.

In order to user the TextKey REST API calls via javascript, you will need to setup the API payload using the appropriate parameters and the API key formatted as a JSON string and then make an Ajax POST request. The POST header does need to be setup as a JSON request (i.e. an application/json header) or you will not get a response.

You will be returned a JSON string as the API call payload.

NOTE: Exposing your API key via any client side code is not recommended. If you choose to use the TextKey API calls via a Javascript call, make sure to create a temporary API Key using the getTempAPIKey API call server side and then use that temporary key during its lifespan on any client side API calls.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
// Build a class to handle the API call input payload
function textkeyPayload(apiKey, command, cellNumber, ownerFName, ownerLName, suppl1, suppl2, userID, isHashed, pinCode, distressPinCode, ownerBirthDate, ownerGender, q1, a1, q2, a2, q3, a3, TextKeyMode, ReceiveMode) {
    this.apiKey = apiKey;
    this.command = command;
    this.cellNumber = cellNumber;
    this.ownerFName = ownerFName;
    this.ownerLName = ownerLName;
    this.suppl1 = suppl1;
    this.suppl2 = suppl2;
    this.userID = userID;
    this.isHashed = isHashed;
    this.pinCode = pinCode;
    this.distressPinCode = distressPinCode;
    this.ownerBirthDate = ownerBirthDate;
    this.ownerGender = ownerGender;
    this.q1 = q1;
    this.a1 = a1;
    this.q2 = q2;
    this.a2 = a2;
    this.q3 = q3;
    this.a3 = a3;
    this.TextKeyMode = TextKeyMode;
    this.ReceiveMode = ReceiveMode;
    this.toJsonString = function () { 
			return JSON.stringify({ 'DataIn': this }); 
		};
};

// Handle the API Request and response
function textkeyAPIRequest(txtCommand, APIJSONData) {
	// Setup the API URL
	var urlAPI = 'http://www.textkey.com/REST/TKRest.asmx/'+txtCommand;

	// Make the API call via a JSON Ajax request
	$.ajax({
		type: "POST",
		contentType: "application/json; charset=utf-8",
		url: urlAPI,
		data: APIJSONData,
		dataType: "json",
		success: function (APIResponse, textStatus) {
			document.write("textStatus: "+textStatus+ "<HR>");
			document.write("API Response: "+JSON.stringify(APIResponse, null, 4) + "<HR>");
			if (textStatus == 'success') {
				if (APIResponse.hasOwnProperty('d')) {
					APIPayload = APIResponse.d;
				} else {
					APIPayload = APIResponse;
				}
				document.write("API Payload: "+JSON.stringify(APIPayload, null, 4) + "<HR>");
				if (APIPayload.errorDescr == "") {
					document.write("userID: " + APIPayload.userID);
				}
				else {
					document.write("Error: " + APIPayload.errorDescr);
				}
			}
			else {
				document.write("Error: " + textStatus);
			}
		},
		error: function (jqXHR, textStatus, errorThrown) {
			document.write("Error: " + jqXHR.status);
		}
	});
}

// Setup the API command
var txtCommand = 'registerTextKeyUserCSA';
// Build the API payload
var registerTextKeyUserCSA = new textkeyPayload("9021fa44-f1bc-4590-b975-42fee031e078", "Query", "8181231234", "", "", "", "", "", true, "", "", "", "", "", "", "", "", "", "", "TextKeyOnly", "AnyCode");
// Make the API Call
textkeyAPIRequest(txtCommand, registerTextKeyUserCSA.toJsonString());
</script>

SOAP Example

Authentication Settings

A SOAP header is required on all SOAP API calls using the _Key variant and the header information is identical on all calls.

registerTextKeyUserCSA requires a SOAP header.
registerTextKeyUserCSA_Key does not require a SOAP header but uses the API Key in the body of the SOAP request.

Authentication Settings using an API Key
API Key: 9021fa44-f1bc-4590-b975-42fee031e078

OR

Authentication Settings using an UserID/Password Combination
userId: 1ed93006208f0540e452e3a37d8299bc
Password: Password12345
Campaign:
Keyword:

The WSDL document for the TextKey SOAP interface is located at: https://secure.textkey.com/ws/textkey.asmx?wsdl.

The address for the SOAP calls on the TextKey interface is: https://secure.textkey.com/ws/textkey.asmx.

The name space for the SOAP calls on the TextKey interface is: https://secure.textkey.com/services/.

Call Parameters

The parameters should look something like this:

apiKey: 9021fa44-f1bc-4590-b975-42fee031e078
command: Query
cellNumber: 850410576
ownerFName: 
ownerLName: 
suppl1: 
suppl2: 
userID: 
isHashed: 1
pinCode: 
distressPinCode: 
ownerBirthDate: 
ownerGender: M
q1: 
a1: 
q2: 
a2: 
q3: 
a3: 
TextKeyMode: TextKeyOnly
ReceiveMode: AnyCode

SOAP Request

The SOAP request should look something like this:

SOAP Request using the API Key

OR

SOAP Request using the UserID/Password

SOAP Response

The SOAP response should look something like this:

SOAP Response with an valid payload

OR

SOAP Response with an error

Output Results

The final results will need to be extracted from the XML response payload should look something like this:

SOAP Response with a valid payload
stdClass Object
(
    [action] => 0
    [cellNumber] => 8181231234
    [ownerFName] => Stan
    [ownerLName] => Steamer
    [suppl1] => No
    [suppl2] => Yes
    [userID] => Stan
    [textKeyMode] => TextKeyOnly
    [receiveMode] => AnyCode
    [pinCode] => 123
    [distressPinCode] => 1234
    [ownerBirthDate] => 12/25/1984
    [ownerGender] => M
    [q1] => q1
    [a1] => a1
    [q2] => q2
    [a2] => a2
    [q3] => q3
    [a3] => a3
    [errorDescr] => 
)
action: 0
cellNumber: 8181231234
ownerFName: Stan
ownerLName: Steamer
suppl1: No
suppl2: Yes
userID: Stan
textKeyMode: TextKeyOnly
receiveMode: AnyCode
pinCode: 123
distressPinCode: 1234
ownerBirthDate: 12/25/1984
ownerGender: M
q1: q1
a1: a1
q2: q2
a2: a2
q3: q3
a3: a3
errorDescr: 

OR

SOAP Response with an error
stdClass Object
(
    [textKeyMode] => TextKeyOnly
    [receiveMode] => AnyCode
    [errorDescr] => Invalid Login
)
Error: Invalid Login.

SOAP Code Examples

PHP

The PHP Helper library contain a textkey class that makes calling TextKey SOAP API functions simple. Just include the helper file textkey_soap.php in your PHP code, inititalize a textkey object using your credentials (i.e. either an API key or a UserID/Password), and then make the API call with the appropriate parameters. You will be returned an object with the API call payload.

// Include the TextKey classes
include_once("../textkey_soap.php");

// Setup the API call parameters
$Command = "Query";
$CellNumber = "8181231234";
$OwnerFName = "";
$OwnerLName = "";
$Suppl1 = "";
$Suppl2 = "";
$RegUserID = "";
$isHashed = TRUE;
$PinCode = "";
$DistressPinCode = "";
$TextKeyMode = "TextKeyOnly";
$ReceiveMode = "AnyCode";
$Ownerbirthdate = "";
$Gender = "";
$q1 = "";
$a1 = "";
$q2 ="";
$a2 = "";
$q3 = "";
$a3 = "";

// Set the authentication
$apikey = "9021fa44-f1bc-4590-b975-42fee031e078";

// Create a textkey object
if ($apikey != "") {
    $tk = new textKey("", "", "", "", $apikey);
}

// Handle the operation
$textkey_result = $tk->perform_registerTextKeyUserCSA($Command, $CellNumber, $OwnerFName, $OwnerLName, $Suppl1, $Suppl2, $Ownerbirthdate, $Gender, $RegUserID, $isHashed, $PinCode, $DistressPinCode, $q1, $a1, $q2, $a2, $q3, $a3, $TextKeyMode, $ReceiveMode);

// Show the textkey API payload object
print_r($textkey_result);
echo "<HR>";

// Handle the results
if ($textkey_result->errorDescr == "") {
    $tkResultsArr = get_object_vars($textkey_result);
  	$results = "";
  foreach($tkResultsArr as $key => $value) { 
        $results .= $key . ': ' . $value . "<BR>";
    } 			
}
else {
    $results = 'Error: ' . $textkey_result->errorDescr . "<BR>";
}
echo $results;

CURL

From a command line, you can test the SOAP API calls using a CURL request:

The SOAP registerTextKeyUserCSA Request is stored in a file called registerTextKeyUserCSA.xml
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >
    <soap:Body>
        <registerTextKeyUserCSA_Key xmlns="https://secure.textkey.com/services/">
            <apiKey>9021fa44-f1bc-4590-b975-42fee031e078</apiKey>
                <command>Query</command>
                    <cellNumber>850410576</cellNumber>
                        <ownerFName>
                        </ownerFName>
                        <ownerLName>
                        </ownerLName>
                        <suppl1>
                        </suppl1>
                        <suppl2>
                        </suppl2>
                        <userID>
                        </userID>
                        <isHashed>true</isHashed>
                            <TextKeyMode>TextKeyOnly</TextKeyMode>
                                <ReceiveMode>AnyCode</ReceiveMode>
                                    <pinCode>
                                    </pinCode>
                                    <distressPinCode>
                                    </distressPinCode>
                                    <ownerGender>M</ownerGender>
                                        <q1>
                                        </q1>
                                        <a1>
                                        </a1>
                                        <q2>
                                        </q2>
                                        <a2>
                                        </a2>
                                        <q3>
                                        </q3>
                                        <a3>
                                        </a3>
                                    </registerTextKeyUserCSA_Key>
                                </soap:Body>
                            </soap:Envelope>
CURL command using registerTextKeyUserCSA.xml
curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:" -d @registerTextKeyUserCSA.xml -X POST https://secure.textkey.com/ws/textkey.asmx
XML Response from API registerTextKeyUserCSA Request
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <registerTextKeyUserCSA_KeyResponse xmlns="https://secure.textkey.com/services/">
            <registerTextKeyUserCSA_KeyResult>
                <action>0</action>
                    <cellNumber>8181231234</cellNumber>
                        <ownerFName>Stan</ownerFName>
                            <ownerLName>Steamer</ownerLName>
                                <suppl1>No</suppl1>
                                    <suppl2>Yes</suppl2>
                                        <userID>Stan</userID>
                                            <textKeyMode>TextKeyOnly</textKeyMode>
                                                <receiveMode>AnyCode</receiveMode>
                                                    <pinCode>123</pinCode>
                                                        <distressPinCode>1234</distressPinCode>
                                                            <ownerBirthDate>12/25/1984</ownerBirthDate>
                                                                <ownerGender>M</ownerGender>
                                                                    <q1>q1</q1>
                                                                        <a1>a1</a1>
                                                                            <q2>q2</q2>
                                                                                <a2>a2</a2>
                                                                                    <q3>q3</q3>
                                                                                        <a3>a3</a3>
                                                                                            <errorDescr />
                                                                                        </registerTextKeyUserCSA_KeyResult>
                                                                                    </registerTextKeyUserCSA_KeyResponse>
                                                                                </soap:Body>
                                                                            </soap:Envelope>