4.1.2. Depending on the type of Resource, the API Client MAY invoke the supported methods (e.g. POST, GET, PUT, DELETE) to achieve an action or a set of actions.
4.1.3. The following are the publicly available Resources that are used for interchange between the MGW and the user’s system:
4.1.3.1. Document Resource
4.1.3.2. DeliveryReceipt Resource
Field | Description | Version | MO/MT |
id | String; Globally unique identifier of the document message.For MT documents, API Clients MUST inject and generate their own IDs (must be equal to 32 alphanumeric characters) for the DeliveryReceipt. |
MO, MT system generated | |
from | String; The source of the document;For MT documents, this will be the VirtualShortCode OR a suffixed VirtualShortCode. For MO documents, this will be the mobile number OR a masked-mobile-number. |
MO (required), MT (required) |
|
to | String; The destination of the document;For MT documents, this will be the mobile number OR a masked-mobile-number. For MO documents, this will be the VirtualShortCode OR a suffixed VirtualShortCode. |
MO (required), MT (required) |
|
content_type | String;
The MIME type of the content body. |
MO (required), MT (required) |
|
date | String;
The date of the document. Format can be: The default timezone is “UTC” (GMT) if |
MO (required), MT (required) |
|
usagetype | String;
Application code for context and logging. For MT documents under VirtualShortCodes with MT-billing (i.e. Reverse SMS billing, where recipient is charged), the usagetype value resolves to the applicable Telco tariff code (charge amount) for the document. This is provisioned and configured per User |
MO (optional), MT (required) |
|
delivery_receipt_url | String; URL where the Messaging Gateway will attempt to POST the status of the document. (see DeliveryReceipt resource) |
MT (optional) | |
thread | String; The thread identifier for tying the MT response to the original MO document. Depending on the Telco requirements, this MAY be required. This is provisioned and configured per User. |
MO (optional), MT (optional) | |
telco | String;
The unique name of the Telco. This is for logging and customization purposes (e.g. per-Telco reply document customization). This is provisioned and configurable per User. |
MO (optional), MT (not applicable) |
application/vnd.net.wyrls.Document-v3+json
4.3.2. Serialization formats supported:
json = Javascript Object Notation
4.4 Example Document Representation
4.4.1 Sample MO Document (inbound document, as sent from mobile to VirtualShortCode 100234):
{
“message_id”: “61LYH8UZX98OOY11BKERQ2J6XZY2IDT0”,
“from”: “639191234444”,
“to”: “100234”,
“content_type”: “text/plain”,
“body”: “hello world”,
“usagetype”: “MYSERVICE_INBOUND”,
“thread”: “120123182418”,
“telco”: “smart”,
“date”: “20120123T102537”
}
4.4.2. Sample MT Document (outbound document, as sent by API Client from AccessNumber 100234 to mobile)
{
“message_id”: “61LYH8UZX98OOY11BKERQ2J6XZY2IDT0”,
“from”: “100234”,
“to”: “639191234444”,
“content_type”: “text/plain”,
“body”: “Sorry, you sent an invalid keyword. Text HELP to 100234”,
“usagetype”: “MYSERVICE_REPLY_PREMIUM”,
“thread”: “120123182418”,
“date”: “2012-01-23T18:25:43+0800”,
“delivery_receipt_url”: “http://12.34.56.78/uri/to/delivery_receipt_handler”
}
POST /documents HTTP/1.1
Host: <hostname>
Authorization: Basic <base64_encoded_account>
Date: Thu, 2 Feb 2012 22:38:34 GMT
Content-Type: application/vnd.net.wyrls.Document-v3+json
Content-Length: Nnnn
<MT_Document_resource_encoded_as_json>
4.5.3 Successful Response
4.5.3.1. The HTTP status code 202 Accepted means that the document was successfully created and enqueued for delivery.
4.5.4 Error Response
4.5.4.1. Error status codes MAY include X-Client-Erro r header for diagnostics purposes.
HTTP Status Code | HTTP Status Code Description |
4xx | Client error, please consult the HTTP headers for additional information. |
5xx | Server error, escalate to support contact. |
4.6.2. Request
4.6.2.1. The MGW user-agent will issue an HTTP POST request with the following:
POST <URL_endpoint_uri_path> HTTP/1.1
Host: <hostname>
Authorization: Basic <base64_encoded_account>
Date: Thu, 2 Feb 2012 22:38:34 GMT
Content-Type: application/vnd.net.wyrls.Document-v3+json
Content-Length: Nnnn
<MO_Document_resource_encoded_as_json>
4.6.3. Successful Response
4.6.3.1. The HTTP status code 202 Accepted means that the document was successfully created and enqueued for delivery.
4.6.3.2. The MGW user-agent MAY also accept any 2xx code
4.6.4. Error Response
HTTP Status Code | HTTP Status Code Description |
4xx | The MGW user-agent MAY retry. Upon repeated 4xx errors, MGW user-agent MAY rate-limit / back-off |
5xx | The MGW user-agent MAY retry. Upon repeated 5xx errors, MGW user-agent MAY rate-limit / back-off. |
Field | Description | Version |
id | String; Unique identifier (uuid) of the delivery receipt. |
1 |
message_id | String; The id of the MT document where this delivery receipt applies. See the id field of the Document Resource. |
1 |
delivered | Boolean; If true ; this means that the MT document was delivered to the SMSC/MMSC. If false ; this means that the delivery of the MT document failed (rejected by the SMSC/MMSC). |
1 |
reason_code | String; Describes additional information on the value of the “delivered” field. ( See table below for the standard values ). |
2 |
reason_description | String; Describes additional information on the “reason_code” field. (See table below for the standard values). |
2 |
HTTP Status Code | HTTP Status Code Description |
200 | OK
It means successfully delivered MT document to the SMSC/MMSC. |
400 | Bad Request It means failed to deliver MT document due to bad syntax or invalid format. |
402 | Payment Required It means failed to deliver MT document due to insufficient or undetermined balance to fulfill the transaction |
404 | Not Found It means failed to deliver MT document due to missing information needed by the SMSC / MMSC. |
500 | Internal Server Error It means failed to deliver MT document due to MGW / SMSC / MMSC error (general system error). |
503 | Service Unavailable It means failed to deliver MT document due to temporary unavailability or capacity error in the MGW / SMSC / MMSC |
4.7.2. Delivery Receipt Representation
4.7.2.1. Every delivery receipt is identified by the content type:
application/vnd.net.wyrls.DeliveryReceipt-v2+json
4.7.2.2. Serialization format is :
json = Javascript Object Notification
4.7.3. Example DeliveryReceipt Representation
{
“id”: “61LYH8UZX98OOY11BKERQ2J6XZY2IDT0”
“message_id”: “61LYH8UZX98OOY11BKERQ2J6XZY2IDT0”,
“delivered”: true,
“reason_code”: 200,
“reason_description”: “OK”
}
4.8.1. Requirements
4.8.1.1. The User MUST setup the URL endpoint where DeliveryReceipts will be sent (HTTP POST).
4.8.1.2. This URL is set per MT document (see the Document Resource field delivery_receipt_url ).
4.8.2. Request
4.8.2.1. The MGW user-agent will issue an HTTP POST request with the following:
POST <URL_endpoint_uri_path> HTTP/1.1
Host: <hostname>
Authorization: Basic <base64_encoded_account>
Date: Thu, 2 Feb 2012 22:38:34 GMT
Content-Type: application/vnd.net.wyrls.Document-v2+json
Content-Length: Nnnn
<MO_Document_resource_encoded_as_json>
4.8.3. Successful Response
4.8.3.1. The HTTP status code 202 Accepted should means that the delivery_receipt was successfully created and enqueued for processing.
4.8.3.2. The MGW user-agent MAY also accept any 2xx code.
4.8.4. Error Response
HTTP Status Code | HTTP Status Code Description |
4xx | The MGW user-agent MAY retry. Upon repeated 4xx errors, MGW user-agent MAY rate-limit / back-off. |
5xx | The MGW user-agent MAY retry. Upon repeated 5xx errors, MGW user-agent MAY rate-limit / back-off. |