Get Reports (Polling)
Every time you send a message you can get a delivery report. This method let you request what's the delivery status of a message by polling.
NOTE
Delivery reports can be queried using this method for up to a month after they were received. Requesting reports from a date past that limit will yield no results.
We recommend that you use Get Delivery Report (Callback) instead because it's more efficient.
Endpoint
https://api.gateway360.com/api/3.0/sms/get-reports
Request
api_key | Your API Key. |
sms_id | The id of the message you sent. This id is given as response when you send a message. |
custom | If you set a custom field when you sent a message you can get the report using your reference. |
page | Number of the page you request, default is 1. |
from_date | Obtain reports from this date onwards. Format is YYYY-MM-DD HH:MM:SS. |
to_date | Obtain reports up to this date. Format is YYYY-MM-DD HH:MM:SS. |
Optional
{
"api_key":"399d2b438a53ebed3db8a7d52107f846",
"sms_id":"1cca1aa9742d400989c21413dc841faa"
}
curl -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"api_key":"399d2b438a53ebed3db8a7d52107f846",
"sms_id":"1cca1aa9742d400989c21413dc841faa"
}' https://api.gateway360.com/api/3.0/sms/get-reports
$request = '{
"api_key":"399d2b438a53ebed3db8a7d52107f846",
"sms_id":"1cca1aa9742d400989c21413dc841faa"
}';
$headers = array('Content-Type: application/json');
$ch = curl_init('https://api.gateway360.com/api/3.0/sms/get-reports');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$result = curl_exec($ch);
if (curl_errno($ch) != 0 ){
die("curl error: ".curl_errno($ch));
}
/** Imports */
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
/** End imports */
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost("https://api.gateway360.com/api/3.0/sms/send");
StringEntity params = new StringEntity(
"{" +
" \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"," +
" \"sms_id\":\"1cca1aa9742d400989c21413dc841faa\"" +
"}");
request.addHeader("content-type", "application/json");
request.addHeader("Accept","application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
require 'uri'
require 'net/http'
url = URI("https://api.gateway360.com/api/3.0/sms/get-reports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = '{
"api_key":"399d2b438a53ebed3db8a7d52107f846",
"sms_id":"1cca1aa9742d400989c21413dc841faa"
}'
response = http.request(request)
puts response.read_body
conn = http.client.HTTPSConnection("api.gateway360.com")
payload = '{
"api_key":"399d2b438a53ebed3db8a7d52107f846",
"sms_id":"1cca1aa9742d400989c21413dc841faa"
}'
headers = {
'content-type': "application/json",
'accept': "application/json"
}
conn.request("POST", "/api/3.0/sms/get-reports", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("https://api.gateway360.com/api/3.0/sms/get-reports");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", '{
"api_key":"399d2b438a53ebed3db8a7d52107f846",
"sms_id":"1cca1aa9742d400989c21413dc841faa"
}', ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Private Sub Command1_Click()
Dim objHTTP As Object
Dim Json As String
Dim result As String
Json = fJSON
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URl = "https://api.gateway360.com/api/3.0/sms/get-reports"
objHTTP.Open "POST", URl, False
objHTTP.setRequestHeader "Content-type", "application/json"
objHTTP.send (Json)
result = objHTTP.responseText
Set objHTTP = Nothing
End Sub
Private Function fJSON() As String
fJSON = "{"
fJSON = fJSON & """api_key"":""399d2b438a53ebed3db8a7d52107f846"","
fJSON = fJSON & """sms_id"":""1cca1aa9742d400989c21413dc841faa"""
fJSON = fJSON & "}"
End Function
Our server will respond with up to 1,000 delivery reports, so if you want to check more you must set the param "page".
Response
status | The sending status of request - either "ok", "error" | ||||||||||||
result | Array of delivery reports founds.
|
||||||||||||
error_id | In case the status values "error" we will indicate you here the error id. | ||||||||||||
error_msg | In case the status values "error" this param has additional information. This param should be use just for debugging. |
200 OK
{
"status":"ok",
"result":[
{
"sms_id":"034d2acec0eb44af842de6a00bf4d934",
"from":"GOOD PIZZA",
"to":"34666666666",
"custom":"YourReferenceID-774843",
"status":"DELIVRD",
"dlr_date":"2015-06-02 01:43:50"
},
{
"sms_id":"034d2acec0eb44af842de6a00bf4d892",
"from":"GOOD PIZZA",
"to":"34666666667",
"custom":"YourReferenceID-774849",
"status":"DELIVRD",
"dlr_date":"2015-06-02 01:43:49"
}
]
}
Two delivery reports found
200 OK
{
"status":"ok",
"result":[
]
}
0 delivery reports found, that means we couldn't find any delivery report: because the operator didn't send us that information or because it was stored more than 30 days in our systems. We recommend that if you don't get any delivery report of a message after more than 48 hours, you should stablish it as UNKNOWN in your systems
401 Unauthorized
{
"status":"error",
"error_id":"UNAUTHORIZED",
"error_msg":"Your API key may be invalid or your IP is blocked."
}
We didn't continue processing your request because your API Key wasn't valid.
400 Bad Request
{
"status":"error",
"error_id":"JSON_PARSE_ERROR",
"error_msg":"Your JSON was formatted incorrectly."
}
We couldn't process your request.
Status values
DELIVRD | Message delivered to destination. |
ACCEPTD | Message is in accepted state, this state is temporary. |
EXPIRED | Message validity period has expired, the expiration of a message is 48 hours if not specified. |
DELETED | Message has been deleted due to the operator's reasons. |
UNDELIV | Message wasn't delivered by SMSC, expiration, not reachable, operator problems, portability... |
REJECTD | Message is in rejected state, the destination or the operator rejected the message. |
Errors
Error ID | Explanation |
---|---|
INVALID_CONTENT_TYPE | The content type must be: Content-Type: application/json |
JSON_PARSE_ERROR | Your JSON was formatted incorrectly or was considered otherwise improper or incomplete. Check it here. |
MISSING_PARAMS | Your request is incomplete and missing some mandatory parameters. |
UNAUTHORIZED | Your API key may be invalid, double-check that your API key was input correctly or see if the IP is blocked in your account API settings. |