SMS API
GetKeywords
This method returns all custom keywords currently assigned to a license key.
Endpoint
GET:https://messaging.esendex.us/Messaging.svc/GetKeywords?LicenseKey={LICENSEKEY}
POST:https://messaging.esendex.us/Messaging.svc/GetKeywords
Syntax
GetKeywords(LicenseKey)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
LicenseKey | Your license key. | GUID | True | 00000000-0000-0000-0000-000000000000 |
Response
Returns: GetKeywordsResponse
object
Code Samples
You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.
- C#
- JavaScript
- JSON POST Request
- JSON Response
- PHP with cURL
- Python
- Ruby
- XML POST Request
- XML Response
C#
// https://messaging.esendex.us/Messaging.svc?wsdl was added as a Service Reference and given the name WSDL
using WSDL;
var client = new MessagingClient(MessagingClient.EndpointConfiguration.mms2wsHttpBindingSecure);
var keywords = await client.GetKeywordsAsync(YOUR_LICENSE_KEY);
foreach (var keyword in keywords.SMSKeyword)
{
Console.WriteLine(
"Keyword: " + keyword.Keyword + Environment.NewLine +
"Short Code: " + keyword.ShortCode + Environment.NewLine +
"UTC Entry Date: " + keyword.EntryDate + Environment.NewLine +
"Return Code: " + keyword.ReturnCode + Environment.NewLine);
}
JavaScript
const params = new URLSearchParams({
'LicenseKey': '00000000-0000-0000-0000-000000000000'
});
const url = 'https://messaging.esendex.us/Messaging.svc/GetKeywords?' + params.toString();
const response = await fetch(url, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
});
const keywords = await response.json();
console.log(keywords);
JSON POST Request
"1627aea5-8e0a-4371-9022-9b504344e724"
JSON Response
{
"ReturnCode": 0,
"SMSKeyword": [
{
"EntryDate": "\/Date(928164000000-0400)\/",
"Keyword": "String content",
"ReturnCode": 0,
"ShortCode": "String content"
}
]
}
PHP with cURL
<?php
$url = 'https://messaging.esendex.us/Messaging.svc/GetKeywords?LicenseKey=YOUR LICENSE KEY';
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HTTPGET, true);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
$result = curl_exec($cURL);
curl_close($cURL);
print_r($result);
?>
Python
import httpx
headers = {"Accept": "application/json"}
url = "https://messaging.esendex.us/Messaging.svc/GetKeywords"
request = {"LicenseKey": "00000000-0000-0000-0000-000000000000"}
with httpx.Client(headers=headers) as client:
response = client.get(url=url, params=request)
response.raise_for_status()
print(response.json())
Ruby
require 'json'
require 'net/http'
headers = { Accept: 'application/json', 'Content-Type': 'application/json' }
uri = URI('https://messaging.esendex.us/Messaging.svc/GetKeywords')
params = {
'LicenseKey': '00000000-0000-0000-0000-000000000000'
}
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get(uri, headers)
raise response.message if response.is_a?(Net::HTTPClientError) || response.is_a?(Net::HTTPServerError)
puts JSON.parse(response)
XML POST Request
<guid xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1627aea5-8e0a-4371-9022-9b504344e724</guid>
XML Response
<SMSKeywordResponse xmlns="http://sms2.cdyne.com">
<ReturnCode>NoError</ReturnCode>
<SMSKeyword>
<KeywordResponseInfo>
<EntryDate>1999-05-31T11:20:00</EntryDate>
<Keyword>String content</Keyword>
<ReturnCode>NoError</ReturnCode>
<ShortCode>String content</ShortCode>
</KeywordResponseInfo>
<KeywordResponseInfo>
<EntryDate>1999-05-31T11:20:00</EntryDate>
<Keyword>String content</Keyword>
<ReturnCode>NoError</ReturnCode>
<ShortCode>String content</ShortCode>
</KeywordResponseInfo>
</SMSKeyword>
</SMSKeywordResponse>
Let’s start sending, together.