This method retrieves a sound file encoded as an MP3 in a 32, 64, or 128 kbit/s bit rate.
Syntax
GetSoundFileInMP3(SoundFileID, BitRate, LicenseKey)
Request Parameters
| Parameter Name | Description | Data Type | Required | Sample Value | 
|---|---|---|---|---|
| SoundFileID | The sound file’s ID. | String | True | greeting | 
| BitRate | The desired bit rate in kbit/s for the returned MP3 file. Valid bit rates are 32, 64, and 128. | Integer | True | 128 | 
| LicenseKey | Your license key. | String | True | 00000000-0000-0000-0000-000000000000 | 
Response
Returns: GetSoundFileInMP3Response
Description: The sound file.
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#
- Python
- GET Request
- POST Request
- SOAP 1.1 Request
- SOAP 1.1 Response
- SOAP 1.2 Request
- SOAP 1.2 Response
- XML Response
C#
/* https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Service Reference and given the name WSDL */
using WSDL;
var client = new PhoneNotifySoapClient(PhoneNotifySoapClient.EndpointConfiguration.PhoneNotifySoap);
var soundFileId = "greeting";
var bitRate = 128;
var soundFile = await client.GetSoundFileInMP3Async(soundFileId, bitRate, YOUR_LICENSE_KEY);
try
{
    var fs = new FileStream(@"C:UsersPublicgreeting.mp3", FileMode.Create, FileAccess.Write);
    fs.Write(soundFile.GetSoundFileInMP3Result, 0, soundFile.GetSoundFileInMP3Result.Length);
    fs.Close();
    Console.WriteLine("Sound file saved.");
}
catch (Exception ex)
{
    Console.WriteLine(ex);
}
Python
import zeep
client = zeep.Client(wsdl="https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl")
sound_file_id = "greeting"
bit_rate = 128
license_key = "00000000-0000-0000-0000-000000000000"
sound_file = client.service.GetSoundFileInMP3(sound_file_id, bit_rate, license_key)
with open(r"C:UsersPublicgreeting.mp3", "wb") as io:
    io.write(sound_file)
GET Request
GET /NotifyWS/PhoneNotify.asmx/GetSoundFileInMP3?SoundFileID=string&BitRate=string&LicenseKey=string HTTP/1.1
Host: ws.esendex.usPOST Request
POST /NotifyWS/PhoneNotify.asmx/GetSoundFileInMP3 HTTP/1.1
Host: ws.esendex.us
Content-Type: application/x-www-form-urlencoded
Content-Length: length
SoundFileID=string&BitRate=string&LicenseKey=stringSOAP 1.1 Request
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://ws.esendex.us/NotifyWS/GetSoundFileInMP3"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSoundFileInMP3 xmlns="https://ws.esendex.us/NotifyWS/">
      <SoundFileID>string</SoundFileID>
      <BitRate>int</BitRate>
      <LicenseKey>string</LicenseKey>
    </GetSoundFileInMP3>
  </soap:Body>
</soap:Envelope>SOAP 1.1 Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSoundFileInMP3Response xmlns="https://ws.esendex.us/NotifyWS/">
      <GetSoundFileInMP3Result>base64Binary</GetSoundFileInMP3Result>
    </GetSoundFileInMP3Response>
  </soap:Body>
</soap:Envelope>SOAP 1.2 Request
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetSoundFileInMP3 xmlns="https://ws.esendex.us/NotifyWS/">
      <SoundFileID>string</SoundFileID>
      <BitRate>int</BitRate>
      <LicenseKey>string</LicenseKey>
    </GetSoundFileInMP3>
  </soap12:Body>
</soap12:Envelope>SOAP 1.2 Response
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetSoundFileInMP3Response xmlns="https://ws.esendex.us/NotifyWS/">
      <GetSoundFileInMP3Result>base64Binary</GetSoundFileInMP3Result>
    </GetSoundFileInMP3Response>
  </soap12:Body>
</soap12:Envelope>XML Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<base64Binary xmlns="https://ws.esendex.us/NotifyWS/">base64Binary</base64Binary>