Developers

  1. Home
  2. Docs
  3. Developers
  4. Example

Example

Simple Text SMS

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 86
X-ApiKey: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "text": "Hi Bro, whats up?"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 83

{
    "statusCode": 0,
    "messageIds": ["4a57b5a9-59f8-48cc-a21e-3e29cef3d7c4"]
}

Long Text SMS

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 234
X-ApiKey: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "text": "Hi my best friend, what's up on your end?\nI wanna tell you the latest gossip, so get up and drop me a call! I promise, you won't trust your ears when you hear that!"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 145

{
    "statusCode": 0,
    "messageIds": [
        "f44afb66-04d4-4d24-962c-2ad63eba3c11",
        "14483b80-e521-4065-bfea-d55e63c37007"
    ]
}

Flash SMS

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 105
X-Api-Key: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "text": "Hi Bro, whats up?",
    "flash": true
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 83

{
    "statusCode": 0,
    "messageIds": ["8b3b9415-c33b-464c-ae57-427e312435a5"]
}

Unicode Text SMS

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 109
X-Api-Key: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "encoding": "UCS2",
    "text": "Привет мой друг!"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 83

{
    "statusCode": 0,
    "messageIds": ["68f3740d-46f9-44d2-bcf4-a696d318ec71"]
}

Binary SMS

In this example we send a vCard.

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 254
X-Api-Key: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "encoding": "Binary",
    "udh": "06050423F40000",
    "text": "BEGIN:VCARD\nVERSION:2.1\nN:Gump;Forrest\nFN:Forrest Gump\nORG:Bubba Gump Shrimps Ltd.\nTEL;type=WORK:+49 171 234 567 8\nEND:VCARD"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 83

{
    "statusCode": 0,
    "messageIds": ["68f3740d-46f9-44d2-bcf4-a696d318ec71"]
}

Request Delivery Status Information

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 121
X-Api-Key: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "receiveDeliveryStatus": true,
    "text": "Hi Bro, whats up?"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 83

{
    "statusCode": 0,
    "messageIds": ["3d00cd29-d9b6-4683-b424-12af6fd6da60"]
}

Callback

Given a callback template defined in your account, like this:

https://myapi.example.com/dlr?msgId={MessageId}&state={MessageState}&to={To}&from={From}&received={ReceivedDateTime}

The following GET URL will be called if new delivery states are available:

GET /dlr?msgId=3d00cd29-d9b6-4683-b424-12af6fd6da60&state=DELIVERED&to=Buddy%20Holly&from=4&received=2018-03-10T17%3A23%3A15Z
Host: myapi.example.com

Request Delivery Status Information with Client Reference

Request

POST /outbound/sms HTTP/1.1
Host: api.mexedia.com
Accept: application/json
Content-Type: application/json
Content-Length: 158
X-Api-Key: YOUR-API-KEY

{
    "from": "Buddy Holly",
    "to": 491712345678,
    "receiveDeliveryStatus": true,
    "refId": "My-Reference-Id-1234",
    "text": "Hi Bro, whats up?"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 83

{
    "statusCode": 0,
    "messageIds": ["854873a6-74ad-435a-ab1a-670e6207fd5b"]
}

Callback

Given a callback template defined in your account, like this:

https://myapi.example.com/dlr?msgId={MessageId}&state={MessageState}&to={To}&from={From}&received={ReceivedDateTime}&ref={ClientReference}

The following GET URL will be called if new delivery states are available:

GET /dlr?msgId=854873a6-74ad-435a-ab1a-670e6207fd5b&state=DELIVERED&to=Buddy%20Holly&from=4&received=2018-03-10T17%3A23%3A15Z&ref=My-Reference-Id-1234
Host: myapi.example.com

Was this article helpful to you? Yes No

How can we help?