Modica REST API v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
SMS messaging for your application
Base URLs:
Authentication
- HTTP Authentication, scheme: basic
 
Default
post__messages
Code samples
# You can also use wget
curl -X POST https://api.modicagroup.com/rest/gateway/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
POST https://api.modicagroup.com/rest/gateway/messages HTTP/1.1
Host: api.modicagroup.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};
fetch('https://api.modicagroup.com/rest/gateway/messages',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};
fetch('https://api.modicagroup.com/rest/gateway/messages',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'
headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}
result = RestClient.post 'https://api.modicagroup.com/rest/gateway/messages',
  params: {
  }, headers: headers
p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}
r = requests.post('https://api.modicagroup.com/rest/gateway/messages', headers = headers)
print(r.json())
URL obj = new URL("https://api.modicagroup.com/rest/gateway/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
       "bytes"
       "net/http"
)
func main() {
    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
    }
    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/gateway/messages", data)
    req.Header = headers
    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
 'application/json',
    'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
    $response = $client->request('POST','https://api.modicagroup.com/rest/gateway/messages', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
 // ...
POST /messages
Send a message to a single mobile
Body parameter
{
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": "string"
}
Parameters
| Name | In | Type | Required | Description | 
|---|---|---|---|---|
| body | body | Message | true | The message JSON you want to post | 
Example responses
201 Response
[
  0
]
Responses
| Status | Meaning | Description | Schema | 
|---|---|---|---|
| 201 | Created | Create a new SMS message | RestResponse | 
| default | Default | Default Error Response | DefaultError | 
post__messages_broadcast
Code samples
# You can also use wget
curl -X POST https://api.modicagroup.com/rest/gateway/messages/broadcast \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
POST https://api.modicagroup.com/rest/gateway/messages/broadcast HTTP/1.1
Host: api.modicagroup.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": [
    "string"
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};
fetch('https://api.modicagroup.com/rest/gateway/messages/broadcast',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": [
    "string"
  ]
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};
fetch('https://api.modicagroup.com/rest/gateway/messages/broadcast',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'
headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}
result = RestClient.post 'https://api.modicagroup.com/rest/gateway/messages/broadcast',
  params: {
  }, headers: headers
p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}
r = requests.post('https://api.modicagroup.com/rest/gateway/messages/broadcast', headers = headers)
print(r.json())
URL obj = new URL("https://api.modicagroup.com/rest/gateway/messages/broadcast");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
       "bytes"
       "net/http"
)
func main() {
    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
    }
    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/gateway/messages/broadcast", data)
    req.Header = headers
    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
 'application/json',
    'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
    $response = $client->request('POST','https://api.modicagroup.com/rest/gateway/messages/broadcast', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
 // ...
POST /messages/broadcast
Send a message to an array of mobiles
Body parameter
{
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": [
    "string"
  ]
}
Parameters
| Name | In | Type | Required | Description | 
|---|---|---|---|---|
| body | body | MessageBroadcast | true | The message JSON you want to post | 
Example responses
201 Response
[
  {
    "id": 0,
    "destination": "string",
    "status": "string",
    "message": "string"
  }
]
Responses
| Status | Meaning | Description | Schema | 
|---|---|---|---|
| 201 | Created | Create a broadcast SMS message to one or more recipients | BroadcastRestResponse | 
| default | Default | Default Error Response | DefaultError | 
get__messages_{messageid}
Code samples
# You can also use wget
curl -X GET https://api.modicagroup.com/rest/gateway/messages/{messageid} \
  -H 'Accept: application/json'
GET https://api.modicagroup.com/rest/gateway/messages/{messageid} HTTP/1.1
Host: api.modicagroup.com
Accept: application/json
const headers = {
  'Accept':'application/json'
};
fetch('https://api.modicagroup.com/rest/gateway/messages/{messageid}',
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');
const headers = {
  'Accept':'application/json'
};
fetch('https://api.modicagroup.com/rest/gateway/messages/{messageid}',
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'
headers = {
  'Accept' => 'application/json'
}
result = RestClient.get 'https://api.modicagroup.com/rest/gateway/messages/{messageid}',
  params: {
  }, headers: headers
p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json'
}
r = requests.get('https://api.modicagroup.com/rest/gateway/messages/{messageid}', headers = headers)
print(r.json())
URL obj = new URL("https://api.modicagroup.com/rest/gateway/messages/{messageid}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
       "bytes"
       "net/http"
)
func main() {
    headers := map[string][]string{
        "Accept": []string{"application/json"},
    }
    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.modicagroup.com/rest/gateway/messages/{messageid}", data)
    req.Header = headers
    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
    $response = $client->request('GET','https://api.modicagroup.com/rest/gateway/messages/{messageid}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
 // ...
GET /messages/{messageid}
Retreives detail of an already created message
Parameters
| Name | In | Type | Required | Description | 
|---|---|---|---|---|
| messageid | path | number(int64) | true | Message ID to retrieve | 
Example responses
200 Response
{
  "id": 0,
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": "string"
}
Responses
| Status | Meaning | Description | Schema | 
|---|---|---|---|
| 200 | OK | Successful response | Message | 
| default | Default | Default Error Response | DefaultError | 
Schemas
DefaultError
{
  "message": "string",
  "code": 100
}
Properties
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| message | string | true | none | none | 
| code | integer | true | none | none | 
MessageCommon
{
  "id": 0,
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z"
}
Common properties for single and broadcast messages
Properties
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| id | integer(int64) | false | read-only | none | 
| source | string | false | none | none | 
| content | string | true | none | none | 
| reference | string | false | none | none | 
| class | string | false | none | none | 
| mask | string | false | none | none | 
| sms_class | integer | false | none | none | 
| scheduled | string(date-time) | false | none | Allows scheduling of messages with an upper limit of 60 days | 
MessageBroadcast
{
  "id": 0,
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": [
    "string"
  ]
}
Send a message to multiple handsets
Properties
allOf
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common properties for single and broadcast messages | 
and
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| anonymous | object | false | none | none | 
| » destination | [string] | false | none | none | 
Message
{
  "id": 0,
  "source": "string",
  "content": "string",
  "reference": "string",
  "class": "mt_message",
  "mask": "string",
  "sms_class": 0,
  "scheduled": "2019-08-24T14:15:22Z",
  "destination": "string"
}
Send a message to one handset
Properties
allOf
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common properties for single and broadcast messages | 
and
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| anonymous | object | false | none | none | 
| » destination | string | false | none | none | 
RestResponse
[
  0
]
Properties
None
BroadcastRestResponse
[
  {
    "id": 0,
    "destination": "string",
    "status": "string",
    "message": "string"
  }
]
Properties
| Name | Type | Required | Restrictions | Description | 
|---|---|---|---|---|
| id | integer(int64) | false | none | none | 
| destination | string | false | none | none | 
| status | string | true | none | none | 
| message | string | false | none | none |