Batch forward received SMS to Onlinesim server
POSThttps://{ourserver.com}/api/resellers/addMessages
This request forwards multiple incoming SMS messages to Onlinesim server in a single batch.
We recommend using this method instead of addMessage and sending SMS
in batches, for example once every 5 seconds.
Parameters
header2
| Name | Type | Description |
|---|---|---|
Authorization* | string | see more here |
Content-Type* | string |
Enum: application/json; charset=utf-8 |
Request Body
Your server should send this request when new messages are received and you need to forward multiple SMS at once.
Content-Type
application/jsonSchema
schemaobject
messagesobject[]RequiredArray of messages.
teststring
Optional field for the request body of Reseller API v2. Allowed values are test1, test2.
While being assigned, test1 value will allow the request to be
passed, however the data won't be saved by our server (the function
will not be executed by this request).
While being assigned, test2 value will print out your request's
payload in response.
Can be passed as query parameter (for GET) or as a field in request's body (for POST). Both ways are equivalent, but using them simultaneously is not recommended.Enum:test1test2Examples
Example payload of your server `addMessages` request
{
"messages": [
{
"number": "33712345678",
"from": "Telegram",
"message": "Code: 12345"
},
{
"number": "33712345679",
"from": "WhatsApp",
"message": "Code: 56789"
}
]
}Responses
200Onlinesim server response
Content-Type
application/jsonSchema
schemaobject
responsestringRequired
1 if at least one message was processed successfully,
otherwise 0Enum:01totalintegerRequired
Total number of processed entriessuccessintegerRequired
Number of successfully processed messagesfailedintegerRequired
Number of failed messagesresultsobject[]RequiredPer-message processing results
Examples
Onlinesim server response example for `addMessages` request21 lines
{
"response": "1",
"total": 2,
"success": 1,
"failed": 1,
"results": [
{
"index": 0,
"number": "33712345678",
"from": "Telegram",
"response": "1"
},
{
"index": 1,
"number": "33712345679",
"from": "WhatsApp",
"response": "0",
"error": "NO_OPERATION"
}
]
}Incorrect key passed
[
{
"response": "ERROR_WRONG_KEY"
}
]400Missing or incorred parameters (request must contain parameters in it's body with proper names as described in documentation)
Content-Type
application/jsonSchema
schemaobject
responsestringRequired
Enum:ERROR_PARAMSmessagestringRequired
401Unauthorized. The request is missing or uses an invalid API key. Some endpoints may return a 200 status with an ERROR_WRONG_KEY message instead of 401 — check the response body
Content-Type
text/plainSchema
schemastring
Enum:Unauthorized403Forbidden. The request was understood but refused due to insufficient permissions
Content-Type
application/jsonSchema
schemaobject
errorobjectRequired
messagestringRequired
Enum:ERROR_DISABLEDERROR_IPERROR_RENTdetailsobject[]Required
Code Samples
Generating examples...