SendRules
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

SendRules API v0.0.1

SendRules API v0.0.1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Introduction

The SendRules API allows you to send transactional notifications.

SendRules.com is a central place to have your set of localized notifications, your configured channels (email, sms,…) along with your recipient’s preferences to receive those notifications.

Terms

These are some terms and the meaning those have in SendRules

Channel

A Channel is each of the different ways that you can deliver a notification through. Examples of channels are email and SMS.

Provider

A Provider is a service with its specific configuration that allows you to send through a channel.

Examples of providers would be:

  • Sendgrid (email)
  • Mailgun (email)
  • Twilio (SMS)
  • Clickatell (SMS)

A Recipient cannot have a preference of which providers to use for a given notification, only the channels.

Notification

A notification is the information you want to send to a recipient, or set of recipients.

When sending a notification you can provide a payload that will be used to render the templates for that notification.

A notification has a unique name, and collection of content sets (files and templates) for each language and channel you want to support for it.

Content Set

A Content Set is the collection of files required to send through a channel. For example, for email, the content set consists of three elements:

  • Subject
  • Text Content
  • HTML Content

A template is a file that will be evaluated with the

Shipment

A Shipment is a request to send a Notification to a set of Recipients with the Payload for the notification.

Recipient

A Recipient contains the data that can be mapped to one of your users.

Some of those has key value pairs that allows a recipient to receive notifications through certain channels.

Examples of key value pairs used by channels:

Other values are used to choose the content set to use:

  • lang: en_US

And itt can also contain custom fields, that will be merged with the notification payload before executing the template for that recipient.

Examples of key value pairs to be used in templates:

  • foo: bar
  • threshold: 24.32

NOTE: currently only string types are used, and conversion to other types must be done in the templates.

Message

A Message is the shipment payload enriched with the recipient’s data.

Delivery

A Delivery is the message sent to a recipient through a concrete channel.

API Keys

Authentication for all API endpoints require an API Key. In order to use the API you have to sign up, and create an API Key in SendRules.com.

Response Format

All API uses JSON as response format.

Base URLs:

Email: Need more info? Web: Need more info?

Authentication

  • API Key (ApiKeyAuth)
    • Parameter Name: X-Api-Key, in: header. # Using API Key Authentication You can check that your API key is valid making a request to the channels information endpoint:
curl -H 'X-Api-Key: YOUR_API_KEY' 'https://sendrules.com/api/sendrules/channels'

Channels

A Channel is a ways of delivering a notification (email, sms,…)

GetChannels

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/channels \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/channels HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/channels',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/channels',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/channels', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/channels', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/channels");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/channels", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels

Example responses

200 Response

[
  "string"
]

Responses

Status Meaning Description Schema
200 OK Returns a list of names of available channels ChannelList

GetChannelDef

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/channels/{channel_name} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/channels/{channel_name} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/channels/{channel_name}',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/channels/{channel_name}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/channels/{channel_name}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/channels/{channel_name}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/channels/{channel_name}");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/channels/{channel_name}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/{channel_name}

Get Channel Definition

Parameters

Name In Type Required Description
channel_name path string true none

Example responses

200 Response

{
  "name": "email",
  "id": 1,
  "contentDefs": [
    {
      "role": "htmlContent (for an email could also be `textContent` or `subject`)",
      "mimeType": "text/html",
      "optional": false
    }
  ],
  "fields": [
    {
      "name": "fullName",
      "type": "string",
      "desc": "Name to be displayed on the email",
      "optional": true
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Returns the channel definition with the fields
required and optional in order to send a delivery
through this channel. Channel

ListChannelProviders

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/channels/{channel_name}/providers", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/{channel_name}/providers

List the providers that can deliver messages through a given channel.

Parameters

Name In Type Required Description
channel_name path string true none

Example responses

200 Response

{
  "available": [
    {
      "name": "string",
      "channel": "string"
    }
  ],
  "configured": [
    {
      "id": "string",
      "config": {
        "name": "string",
        "configName": "string",
        "configDesc": "string",
        "params": [
          {
            "key": null,
            "val": null
          }
        ]
      }
    }
  ],
  "defaults": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK Returns the list of providers that can
deliver messages through the given channel. ProviderList

SetDefaultProviderConfiguration

Code samples

# You can also use wget
curl -X PUT https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config \
  -H 'Content-Type: application/json' \
  -H 'X-Api-Key: API_KEY'
PUT https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
const inputBody = '{
  "id": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config',
{
  method: 'PUT',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.put 'https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.put('https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://demo.sendrules.com/api/sendrules/channels/{channel_name}/default_provider_config", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /channels/{channel_name}/default_provider_config

Selects a new default provider configuration id for the channel

Body parameter

{
  "id": "string"
}

Parameters

Name In Type Required Description
channel_name path string true none
body body ConfiguredProviderId false Sets the default service provider for the channel id

Responses

Status Meaning Description Schema
200 OK The provided configuration provider id is the new default for
the channel. None
404 Not Found The provided id cannot be found or does not belong to the
channel. None

ConfigureProvider

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/providers/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/providers/ HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "name": "string",
  "configName": "string",
  "configDesc": "string",
  "params": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/providers/',
{
  method: 'POST',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/providers/',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/providers/', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/providers/', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/providers/");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/providers/", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /providers/

Creates a new provider configuration.

Body parameter

{
  "name": "string",
  "configName": "string",
  "configDesc": "string",
  "params": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body ProviderConfig true Creates a new configuration for a provider.

Example responses

201 Response

{
  "id": "string",
  "config": {
    "name": "string",
    "configName": "string",
    "configDesc": "string",
    "params": [
      {
        "key": "string",
        "val": "string"
      }
    ]
  }
}

Responses

Status Meaning Description Schema
201 Created The new provider configuration was created. ConfiguredProvider

DeleteProviderConfiguration

Code samples

# You can also use wget
curl -X DELETE https://demo.sendrules.com/api/sendrules/providers/{provider_config_id} \
  -H 'X-Api-Key: API_KEY'
DELETE https://demo.sendrules.com/api/sendrules/providers/{provider_config_id} HTTP/1.1
Host: demo.sendrules.com

const headers = {
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/providers/{provider_config_id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.delete 'https://demo.sendrules.com/api/sendrules/providers/{provider_config_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'X-Api-Key': 'API_KEY'
}

r = requests.delete('https://demo.sendrules.com/api/sendrules/providers/{provider_config_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://demo.sendrules.com/api/sendrules/providers/{provider_config_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/providers/{provider_config_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
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{
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://demo.sendrules.com/api/sendrules/providers/{provider_config_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /providers/{provider_config_id}

Removes channel configuration

Parameters

Name In Type Required Description
provider_config_id path string true none

Responses

Status Meaning Description Schema
200 OK The resource was deleted
content:
application/json:
schema:
$ref: “#/components/schemas/Channel” None

Notifications

ListNotifications

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/notifications \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/notifications HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/notifications',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/notifications', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/notifications', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/notifications", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /notifications

Gets a list of notifications

Example responses

A page of notifications

{
  "versions": [
    {
      "status": "CURRENT",
      "updated": "2011-01-21T11:33:21Z",
      "id": "v2.0",
      "links": [
        {
          "href": "http://127.0.0.1:8774/v2/",
          "rel": "self"
        }
      ]
    },
    {
      "status": "EXPERIMENTAL",
      "updated": "2013-07-23T11:33:21Z",
      "id": "v3.0",
      "links": [
        {
          "href": "http://127.0.0.1:8774/v3/",
          "rel": "self"
        }
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK A page of notifications NotificationList

CreateNotification

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/notifications \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/notifications HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "name": "string",
  "description": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications',
{
  method: 'POST',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/notifications',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/notifications', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/notifications', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/notifications", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /notifications

Create a new notifications

Body parameter

{
  "name": "string",
  "description": "string"
}

Parameters

Name In Type Required Description
body body NotificationData true Send the notification data

Example responses

A page of notifications

{
  "id": "xxxx",
  "name": "email",
  "description": "subject"
}

Responses

Status Meaning Description Schema
200 OK A page of notifications Notification

GetNotification

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /notifications/{notification_id}

Gets information for a single notifica

Parameters

Name In Type Required Description
notification_id path string true none

Example responses

Get the information for a single notification by providing its ID.

{
  "id": "238932478912341234",
  "name": "test_notification",
  "description": "this is a description",
  "created": "2020-10-02T12:20:20z0000"
}

400 Response

{
  "code": "ERR_DOES_NOT_EXIST",
  "description": "the notification name does not exist"
}

Responses

Status Meaning Description Schema
200 OK Get the information for a single notification by providing
its ID. Notification
400 Bad Request Bad request, a para might be missing or is malformed
Code can be:
  • NOTIFICATION_BADPARAM_MISSING_NOTIFICATION_ID
  • NOTIFICATION_BADPARAM_WRONGFORMAT_NOTIFICATION_ID|APIError| |404|Not Found|The notification does not exist for the given user|APIError|

DeleteNotification

Code samples

# You can also use wget
curl -X DELETE https://demo.sendrules.com/api/sendrules/notifications/{notification_id} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
DELETE https://demo.sendrules.com/api/sendrules/notifications/{notification_id} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.delete 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.delete('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /notifications/{notification_id}

Deletes an existing notification

Parameters

Name In Type Required Description
notification_id path string true none

Example responses

Get the information for a single notification by providing its ID.

238932478912341250

400 Response

{
  "code": "ERR_DOES_NOT_EXIST",
  "description": "the notification name does not exist"
}

Responses

Status Meaning Description Schema
200 OK Get the information for a single notification by providing
its ID. string
400 Bad Request Bad request, a para might be missing or is malformed
Code can be:
  • NOTIFICATION_BADPARAM_MISSING_NOTIFICATION_ID
  • NOTIFICATION_BADPARAM_WRONGFORMAT_NOTIFICATION_ID|APIError| |404|Not Found|The notification does not exist for the given user|APIError|

SetNotificationContent

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role} HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "notificationId": "string",
  "channel": "string",
  "role": "string",
  "lang": "string",
  "content": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}',
{
  method: 'POST',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /notifications/{notification_id}/content/{channel}/{lang}/{role}

Body parameter

{
  "notificationId": "string",
  "channel": "string",
  "role": "string",
  "lang": "string",
  "content": "string"
}
notificationId: string
channel: string
role: string
lang: string
content: string

Parameters

Name In Type Required Description
notification_id path string true none
channel path string true none
lang path string true none
role path string true none
body body NotificationContent true Send the notification data

Example responses

200 Response

"string"

Responses

Status Meaning Description Schema
200 OK Content was successfully uploaded string
400 Bad Request Bad request, content cannot be set APIError

GetNotificationContent

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/content/{channel}/{lang}/{role}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /notifications/{notification_id}/content/{channel}/{lang}/{role}

Parameters

Name In Type Required Description
notification_id path string true none
channel path string true none
lang path string true none
role path string true none

Example responses

200 Response

{
  "notificationId": "string",
  "channel": "string",
  "role": "string",
  "lang": "string",
  "content": "string"
}

Responses

Status Meaning Description Schema
200 OK Retrieves the notificaton content string
400 Bad Request Bad request, content cannot be set APIError

UploadNotificationContent

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role} \
  -H 'Content-Type: application/octet-stream' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role} HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/octet-stream
Accept: application/json
const inputBody = 'string';
const headers = {
  'Content-Type':'application/octet-stream',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role}',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/octet-stream',
  'Accept' => 'application/json',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/octet-stream',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/octet-stream',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role}");
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/octet-stream"},
        "Accept": []string{"application/json"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/upload/{channel}/{lang}/{role}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /notifications/{notification_id}/upload/{channel}/{lang}/{role}

Upload a file as the content for the given notification, channel, language and role. Content type can be any type, but body will be interpreted ast the role definition content type.

Body parameter

string

Parameters

Name In Type Required Description
notification_id path string true none
channel path string true none
lang path string true none
role path string true none
body body string(binary) true none

Example responses

200 Response

"string"

Responses

Status Meaning Description Schema
200 OK Content was successfully uploaded string
400 Bad Request Bad request, content cannot be set APIError

ListNotificationContent

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/contentlist", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /notifications/{notification_id}/contentlist

Parameters

Name In Type Required Description
notification_id path string true none

Example responses

200 Response

{
  "notificationId": "string",
  "contents": [
    {
      "id": "string",
      "channel": "string",
      "role": "string",
      "lang": "string",
      "source": "string",
      "contentType": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Returns all the available content for the notification ContentSetInfo
400 Bad Request Bad request, content cannot be set APIError

ListEnabledLanguages

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/langs/notifications \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/langs/notifications HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/langs/notifications',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/langs/notifications',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/langs/notifications', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/langs/notifications', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/langs/notifications");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/langs/notifications", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /langs/notifications

Example responses

200 Response

{
  "langs": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK Returns the different available languages across all notifications EnabledLanguages
400 Bad Request Bad request, content cannot be set APIError

SetNotificationPreferences

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "channels": [
    {
      "channel": "string",
      "enabled": true
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences',
{
  method: 'POST',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /notifications/{notification_id}/preferences

Body parameter

{
  "channels": [
    {
      "channel": "string",
      "enabled": true
    }
  ]
}

Parameters

Name In Type Required Description
notification_id path string true none
body body NotificationPreferencesAnonym true Sets the channels to use by default to send this notification

Example responses

200 Response

"string"

Responses

Status Meaning Description Schema
200 OK Preferences were successfully set for the notification string
400 Bad Request Bad request, content cannot set notification preference APIError

GetNotificationPreferences

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/notifications/{notification_id}/preferences", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /notifications/{notification_id}/preferences

Parameters

Name In Type Required Description
notification_id path string true none

Example responses

200 Response

{
  "notificationId": "string",
  "channels": [
    {
      "channel": "string",
      "enabled": true
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Get the notification prefernces NotificationPreferences
400 Bad Request Bad request, content cannot get notification preference APIError

Recipients

CreateRecipient

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/recipients \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/recipients HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients',
{
  method: 'POST',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/recipients',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/recipients', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/recipients', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/recipients", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /recipients

Create a new recipient

Body parameter

{
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body RecipientData true Create a new recipient

Example responses

200 Response

{
  "id": "string",
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK The created recipient data with its ID Recipient
400 Bad Request Bad request, content cannot get recipients APIError

ListRecipients

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/recipients \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/recipients HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/recipients',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/recipients', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/recipients', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/recipients", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /recipients

Get a page of recipients

Example responses

200 Response

{
  "recipients": [
    {
      "id": "string",
      "lang": "string",
      "data": [
        {
          "key": "string",
          "val": "string"
        }
      ]
    }
  ],
  "nextPage": "string",
  "prevPage": "string"
}

Responses

Status Meaning Description Schema
200 OK A page of recipients RecipientsPage
400 Bad Request Bad request, content cannot get recipients APIError

UpdateRecipient

Code samples

# You can also use wget
curl -X PUT https://demo.sendrules.com/api/sendrules/recipients/{recipient_id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
PUT https://demo.sendrules.com/api/sendrules/recipients/{recipient_id} HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}',
{
  method: 'PUT',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.put 'https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.put('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /recipients/{recipient_id}

Create a new recipient

Body parameter

{
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Parameters

Name In Type Required Description
recipient_id path string true none
body body RecipientData true Create a new recipient

Example responses

400 Response

{
  "code": "ERR_DOES_NOT_EXIST",
  "description": "the notification name does not exist"
}

Responses

Status Meaning Description Schema
200 OK The created recipient data with its ID None
400 Bad Request Bad request, content cannot get recipients APIError

GetRecipient

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/recipients/{recipient_id} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/recipients/{recipient_id} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /recipients/{recipient_id}

Get information about a single recipient

Parameters

Name In Type Required Description
recipient_id path string true none

Example responses

200 Response

{
  "id": "string",
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK A page of recipients Recipient
400 Bad Request Bad request, content cannot get recipients APIError

DeleteRecipient

Code samples

# You can also use wget
curl -X DELETE https://demo.sendrules.com/api/sendrules/recipients/{recipient_id} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
DELETE https://demo.sendrules.com/api/sendrules/recipients/{recipient_id} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.delete 'https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.delete('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /recipients/{recipient_id}

Delete a recipient from the list

Parameters

Name In Type Required Description
recipient_id path string true none

Example responses

200 Response

{
  "recipients": [
    {
      "id": "string",
      "lang": "string",
      "data": [
        {
          "key": "string",
          "val": "string"
        }
      ]
    }
  ],
  "nextPage": "string",
  "prevPage": "string"
}

Responses

Status Meaning Description Schema
200 OK A page of recipients RecipientsPage
400 Bad Request Bad request, content cannot get recipients APIError

ListRecipientNotificationsPreferences

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /recipients/{recipient_id}/preferences/notifications

Get the full list of notification channel preferences for this recipient

Parameters

Name In Type Required Description
recipient_id path string true none

Example responses

200 Response

{
  "preferences": [
    {
      "notificationId": "string",
      "enabled": [
        "string"
      ],
      "disabled": [
        "string"
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK A page of recipients RecipientChannelPreferences
400 Bad Request Bad request, content cannot get recipients APIError

SetRecipientNotificationPreference

Code samples

# You can also use wget
curl -X PUT https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
PUT https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id} HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
  "enabled": [
    "string"
  ],
  "disabled": [
    "string"
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}',
{
  method: 'PUT',
  body: 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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.put 'https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.put('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /recipients/{recipient_id}/preferences/notifications/{notification_id}

Create a new recipient

Body parameter

{
  "enabled": [
    "string"
  ],
  "disabled": [
    "string"
  ]
}

Parameters

Name In Type Required Description
recipient_id path string true none
notification_id path string true none
body body RecipientNotificationChannelPreferencesAnonym true Create a new recipient

Example responses

400 Response

{
  "code": "ERR_DOES_NOT_EXIST",
  "description": "the notification name does not exist"
}

Responses

Status Meaning Description Schema
200 OK The created recipient data with its ID None
400 Bad Request Bad request, content cannot get recipients APIError

GetRecipientNotificationPreferences

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id} \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id} HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/recipients/{recipient_id}/preferences/notifications/{notification_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /recipients/{recipient_id}/preferences/notifications/{notification_id}

Get the notification channel preferences for a recipient

Parameters

Name In Type Required Description
recipient_id path string true none
notification_id path string true none

Example responses

200 Response

{
  "notificationId": "string",
  "enabled": [
    "string"
  ],
  "disabled": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK A page of recipients RecipientNotificationChannelPreferences
400 Bad Request Bad request, content cannot get recipients APIError

Shipments

CreateShipment

Code samples

# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/shipments/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Idempotency-Key: string' \
  -H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/shipments/ HTTP/1.1
Host: demo.sendrules.com
Content-Type: application/json
Accept: application/json
Idempotency-Key: string
const inputBody = '{
  "idempotencyKey": "string",
  "notification": "string",
  "recipients": [
    "string"
  ],
  "payload": {
    "property1": "string",
    "property2": "string"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Idempotency-Key':'string',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/shipments/',
{
  method: 'POST',
  body: 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',
  'Idempotency-Key' => 'string',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.post 'https://demo.sendrules.com/api/sendrules/shipments/',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Idempotency-Key': 'string',
  'X-Api-Key': 'API_KEY'
}

r = requests.post('https://demo.sendrules.com/api/sendrules/shipments/', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Idempotency-Key' => 'string',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://demo.sendrules.com/api/sendrules/shipments/', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/shipments/");
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"},
        "Idempotency-Key": []string{"string"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://demo.sendrules.com/api/sendrules/shipments/", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /shipments/

Create a new shipment

Body parameter

{
  "idempotencyKey": "string",
  "notification": "string",
  "recipients": [
    "string"
  ],
  "payload": {
    "property1": "string",
    "property2": "string"
  }
}

Parameters

Name In Type Required Description
Idempotency-Key header string false Follows the RFC proposal to use this header as idempotency
body body ShipmentRequest true Creates a new shipment, that consists of an existing

Detailed descriptions

Idempotency-Key: Follows the RFC proposal to use this header as idempotency key. In case it is provided, it will override whatever key is provided in the ShipmentRequest payload

body: Creates a new shipment, that consists of an existing notification name with its payload and a list of recipients to send the notification to.

An idempotency key can be uses to avoid re-sending of shipments in case of failure.

Example responses

200 Response

{
  "shipmentId": "string"
}

Responses

Status Meaning Description Schema
200 OK The created recipient data with its ID ShipmentId
400 Bad Request Bad request, content cannot get recipients APIError

ListShipments

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/shipments/ \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/shipments/ HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/shipments/',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/shipments/',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/shipments/', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/shipments/', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/shipments/");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/shipments/", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /shipments/

Get a page of shipments

Parameters

Name In Type Required Description
from query string false none
backwards query boolean false none
limit query integer false none

Example responses

200 Response

{
  "shipments": [
    {
      "id": "string",
      "notificationId": "string",
      "notification": "string",
      "description": "string",
      "created": "2019-08-24T14:15:22Z",
      "payload": {
        "property1": "string",
        "property2": "string"
      },
      "numRecipients": 0
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK The created recipient data with its ID Shipments
400 Bad Request Bad request, content cannot get recipients APIError

ShipmentsCountAndBoundaries

Code samples

# You can also use wget
curl -X GET https://demo.sendrules.com/api/sendrules/shipments_count/ \
  -H 'Accept: application/json' \
  -H 'X-Api-Key: API_KEY'
GET https://demo.sendrules.com/api/sendrules/shipments_count/ HTTP/1.1
Host: demo.sendrules.com
Accept: application/json

const headers = {
  'Accept':'application/json',
  'X-Api-Key':'API_KEY'
};

fetch('https://demo.sendrules.com/api/sendrules/shipments_count/',
{
  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',
  'X-Api-Key' => 'API_KEY'
}

result = RestClient.get 'https://demo.sendrules.com/api/sendrules/shipments_count/',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'application/json',
  'X-Api-Key': 'API_KEY'
}

r = requests.get('https://demo.sendrules.com/api/sendrules/shipments_count/', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'X-Api-Key' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://demo.sendrules.com/api/sendrules/shipments_count/', 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());
 }

 // ...
URL obj = new URL("https://demo.sendrules.com/api/sendrules/shipments_count/");
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"},
        "X-Api-Key": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://demo.sendrules.com/api/sendrules/shipments_count/", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /shipments_count/

Get the number of shipments and the max and min valid IDs.

This does not mean that those IDs correspond to the minimum and maximum shipment ID, but that those can be used as from parameters in requesting shipment pages.

Example responses

200 Response

{
  "count": 0,
  "minId": "string",
  "maxId": "string"
}

Responses

Status Meaning Description Schema
200 OK The cound and max and min IDs of existing shipments ShipmentsCountAndBoundaries
400 Bad Request Bad request, content cannot get recipients APIError

Schemas

APIError

{
  "code": "ERR_DOES_NOT_EXIST",
  "description": "the notification name does not exist"
}

Properties

Name Type Required Restrictions Description
code string true none a computer readable error
description string true none a user readable error

KeyVal

{
  "key": "string",
  "val": "string"
}

Properties

Name Type Required Restrictions Description
key string true none none
val string true none none

KeyValList

[
  {
    "key": "string",
    "val": "string"
  }
]

Properties

Name Type Required Restrictions Description
anonymous [KeyVal] false none none

Provider

{
  "name": "string",
  "channel": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
channel string true none none

ProviderConfig

{
  "name": "string",
  "configName": "string",
  "configDesc": "string",
  "params": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
name string true none none
configName string false none none
configDesc string false none none
params KeyValList true none none

ConfiguredProvider

{
  "id": "string",
  "config": {
    "name": "string",
    "configName": "string",
    "configDesc": "string",
    "params": [
      {
        "key": "string",
        "val": "string"
      }
    ]
  }
}

Properties

Name Type Required Restrictions Description
id string true none none
config ProviderConfig true none none

ConfiguredProviderId

{
  "id": "string"
}

Properties

Name Type Required Restrictions Description
id string true none none

ProviderList

{
  "available": [
    {
      "name": "string",
      "channel": "string"
    }
  ],
  "configured": [
    {
      "id": "string",
      "config": {
        "name": "string",
        "configName": "string",
        "configDesc": "string",
        "params": [
          {
            "key": null,
            "val": null
          }
        ]
      }
    }
  ],
  "defaults": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
available [Provider] true none none
configured [ConfiguredProvider] true none none
defaults [string] false none none

ContentDef

{
  "role": "htmlContent (for an email could also be `textContent` or `subject`)",
  "mimeType": "text/html",
  "optional": false
}

Properties

Name Type Required Restrictions Description
role string true none the role this content performs inside the content set
mimeType string true none the mime type of this content
optional boolean true none if we are allowed to not provide this content

FieldDef

{
  "name": "fullName",
  "type": "string",
  "desc": "Name to be displayed on the email",
  "optional": true
}

Properties

Name Type Required Restrictions Description
name string true none name of the field
type string true none the type of the field
desc string true none a description of this field
optional boolean true none if we are allowed to not provide this field

Channel

{
  "name": "email",
  "id": 1,
  "contentDefs": [
    {
      "role": "htmlContent (for an email could also be `textContent` or `subject`)",
      "mimeType": "text/html",
      "optional": false
    }
  ],
  "fields": [
    {
      "name": "fullName",
      "type": "string",
      "desc": "Name to be displayed on the email",
      "optional": true
    }
  ]
}

Properties

Name Type Required Restrictions Description
name string true none the name of the channel
id integer true none the id of the channel
contentDefs [ContentDef] true none the list of content that the channel needs or can optionally have
fields [FieldDef] true none the fields required in the recipient data to be able to use this channel

ChannelList

[
  "string"
]

a list of channel names available

Properties

None

NotificationData

{
  "name": "string",
  "description": "string"
}

Properties

Name Type Required Restrictions Description
name string true none none
description string true none none

Notification

{
  "id": "string",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z"
}

Properties

Name Type Required Restrictions Description
id string true none none
name string true none none
description string true none none
created string(date-time) true none none

NotificationList

{
  "notifications": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "created": "2019-08-24T14:15:22Z"
    }
  ]
}

Properties

Name Type Required Restrictions Description
notifications [Notification] true none none

NotificationChannelPreference

{
  "channel": "string",
  "enabled": true
}

Properties

Name Type Required Restrictions Description
channel string true none none
enabled boolean true none none

NotificationPreferencesAnonym

{
  "channels": [
    {
      "channel": "string",
      "enabled": true
    }
  ]
}

Properties

Name Type Required Restrictions Description
channels [NotificationChannelPreference] true none none

NotificationPreferences

{
  "notificationId": "string",
  "channels": [
    {
      "channel": "string",
      "enabled": true
    }
  ]
}

Properties

Name Type Required Restrictions Description
notificationId string true none none
channels [NotificationChannelPreference] true none none

NotificationContent

{
  "notificationId": "string",
  "channel": "string",
  "role": "string",
  "lang": "string",
  "content": "string"
}

Properties

Name Type Required Restrictions Description
notificationId string true none none
channel string true none none
role string true none none
lang string true none none
content string true none none

ContentInfo

{
  "id": "string",
  "channel": "string",
  "role": "string",
  "lang": "string",
  "source": "string",
  "contentType": "string"
}

Properties

Name Type Required Restrictions Description
id string true none none
channel string true none none
role string true none none
lang string true none none
source string true none none
contentType string true none none

ContentSetInfo

{
  "notificationId": "string",
  "contents": [
    {
      "id": "string",
      "channel": "string",
      "role": "string",
      "lang": "string",
      "source": "string",
      "contentType": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
notificationId string true none none
contents [ContentInfo] true none none

EnabledLanguages

{
  "langs": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
langs [string] true none none

RecipientData

{
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
lang string true none none
data KeyValList true none none

Recipient

{
  "id": "string",
  "lang": "string",
  "data": [
    {
      "key": "string",
      "val": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
id string true none none
lang string true none none
data KeyValList true none none

RecipientList

[
  {
    "id": "string",
    "lang": "string",
    "data": [
      {
        "key": "string",
        "val": "string"
      }
    ]
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Recipient] false none none

RecipientsPage

{
  "recipients": [
    {
      "id": "string",
      "lang": "string",
      "data": [
        {
          "key": "string",
          "val": "string"
        }
      ]
    }
  ],
  "nextPage": "string",
  "prevPage": "string"
}

Properties

Name Type Required Restrictions Description
recipients [Recipient] true none none
nextPage string true none none
prevPage string true none none

RecipientNotificationChannelPreferencesAnonym

{
  "enabled": [
    "string"
  ],
  "disabled": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
enabled [string] true none none
disabled [string] true none none

RecipientNotificationChannelPreferences

{
  "notificationId": "string",
  "enabled": [
    "string"
  ],
  "disabled": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
notificationId string true none none
enabled [string] true none none
disabled [string] true none none

RecipientChannelPreferences

{
  "preferences": [
    {
      "notificationId": "string",
      "enabled": [
        "string"
      ],
      "disabled": [
        "string"
      ]
    }
  ]
}

Properties

Name Type Required Restrictions Description
preferences [RecipientNotificationChannelPreferences] true none none

RecipientChannelMissingFields

{
  "channel": "string",
  "missing": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
channel string true none none
missing [string] true none none

RecipientsInfo

{
  "recipient": {
    "id": "string",
    "lang": "string",
    "data": [
      {
        "key": "string",
        "val": "string"
      }
    ]
  },
  "readyChannels": [
    "string"
  ],
  "nonReadyChannels": [
    {
      "channel": "string",
      "missing": [
        "string"
      ]
    }
  ]
}

Properties

Name Type Required Restrictions Description
recipient Recipient true none none
readyChannels [string] true none none
nonReadyChannels [RecipientChannelMissingFields] true none none

ShipmentRequest

{
  "idempotencyKey": "string",
  "notification": "string",
  "recipients": [
    "string"
  ],
  "payload": {
    "property1": "string",
    "property2": "string"
  }
}

Properties

Name Type Required Restrictions Description
idempotencyKey string true none Empty string OR a unique hex string of 32 chars length, that can be
used to retry the shipment in case of failure to avoid
having the shipment sent twice.
notification string true none name of the notification to be sent
recipients [string] true none list of recipien IDs to sent the notification to
payload object true none the data that will be used to render the
notification content templates.
» additionalProperties string false none none

ShipmentPage

{
  "from": "string",
  "backwards": true,
  "limit": 0
}

Properties

Name Type Required Restrictions Description
from string true none none
backwards boolean true none none
limit integer true none none

Shipment

{
  "notification": "string",
  "created": "string",
  "payload": {
    "property1": "string",
    "property2": "string"
  },
  "recipients": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
notification string true none none
created string true none none
payload object true none none
» additionalProperties string false none none
recipients [string] true none none

ShipmentsCountAndBoundaries

{
  "count": 0,
  "minId": "string",
  "maxId": "string"
}

Properties

Name Type Required Restrictions Description
count integer true none none
minId string true none none
maxId string true none none

ShipmentSummary

{
  "id": "string",
  "notificationId": "string",
  "notification": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "payload": {
    "property1": "string",
    "property2": "string"
  },
  "numRecipients": 0
}

Properties

Name Type Required Restrictions Description
id string true none none
notificationId string true none none
notification string false none none
description string true none none
created string(date-time) true none none
payload object true none none
» additionalProperties string false none none
numRecipients integer true none none

ShipmentId

{
  "shipmentId": "string"
}

Properties

Name Type Required Restrictions Description
shipmentId string true none none

Shipments

{
  "shipments": [
    {
      "id": "string",
      "notificationId": "string",
      "notification": "string",
      "description": "string",
      "created": "2019-08-24T14:15:22Z",
      "payload": {
        "property1": "string",
        "property2": "string"
      },
      "numRecipients": 0
    }
  ]
}

Properties

Name Type Required Restrictions Description
shipments [ShipmentSummary] true none none