SendRules Admin API v0.0.1
SendRules Admin 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.
The SendRules Admin API allows you to execute administrative tasks in a sendrules instance.
The admin API is enabled by configuration at startup, so it is
made available by providing the SENDRULES_ADMIN_STATICKEY
with
a key to use.
All API uses JSON as response format.
Base URLs:
Email: Need more info? Web: Need more info?
- 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' \
-H 'Content-Type: application/json' \
'https://demo.sendrules.com/adm/users'
Owners
Code samples
# You can also use wget
curl -X POST https://demo.sendrules.com/api/sendrules/owners \
-H 'Accept: application/json' \
-H 'X-Api-Key: API_KEY'
POST https://demo.sendrules.com/api/sendrules/owners 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/owners',
{
method: 'POST',
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.post 'https://demo.sendrules.com/api/sendrules/owners',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-Api-Key': 'API_KEY'
}
r = requests.post('https://demo.sendrules.com/api/sendrules/owners', 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('POST','https://demo.sendrules.com/api/sendrules/owners', 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/owners");
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{
"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/owners", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /owners
Example responses
201 Response
{
"email": "string",
"id": "string",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Creates an owner and automatically activates it. | Owner |
Code samples
# You can also use wget
curl -X DELETE https://demo.sendrules.com/api/sendrules/owners/{owner_id} \
-H 'Accept: application/json' \
-H 'X-Api-Key: API_KEY'
DELETE https://demo.sendrules.com/api/sendrules/owners/{owner_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/owners/{owner_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/owners/{owner_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/owners/{owner_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/owners/{owner_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/owners/{owner_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/owners/{owner_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /owners/{owner_id}
Deletes an owner user
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
owner_id | path | string | true | none |
Example responses
200 Response
{
"email": "string",
"id": "string",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f"
}
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. | Owner |
APIError
{
"code": "ERR_DOES_NOT_EXIST",
"description": "the notification name does not exist"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | string | true | none | a computer readable error |
description | string | true | none | a user readable error |
Owner
{
"email": "string",
"id": "string",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
string | true | none | none | |
id | string | true | none | none |
uuid | string(uuid) | false | none | none |