Tenants API reference

Full reference for the Tenants API

Add tenant

This endpoint allows you to create a Tenant.

Example

curl -i https://api.serialized.io/tenants \
  --header "Content-Type: application/json" \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  --data '
  {
     "tenantId": "e9ef574f-4563-4d56-ad9e-0a2d5ce42004",
     "reference": "Acme Inc"
  }
  '
import com.google.common.collect.ImmutableMap;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = ClientBuilder.newClient();
  URI apiRoot = URI.create("https://api.serialized.io");

  Map<String, Object> tenant = ImmutableMap.of(
  "tenantId", "e9ef574f-4563-4d56-ad9e-0a2d5ce42004",
  "reference", "Acme Inc"
  );

  Response response = client.target(apiRoot)
  .path("tenants")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .post(Entity.json(tenant));
using System;
using System.Collections.Generic;
using RestSharp;

var tenant = new Dictionary<string, Object>
{
    { "tenantId", "e9ef574f-4563-4d56-ad9e-0a2d5ce42004" },
    { "reference", "Acme Inc" }
};

var client = new RestClient("https://api.serialized.io");

var request = new RestRequest("tenants", Method.POST)
   .AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
   .AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");
   .AddJsonBody(tenant);

var response = client.Execute(request);
const axios = require("axios");

const client = axios.create({
  baseURL: "https://api.serialized.io",
  headers: {
    "Serialized-Access-Key": "<YOUR_ACCESS_KEY>",
    "Serialized-Secret-Access-Key": "<YOUR_SECRET_ACCESS_KEY>"
  }
});

const definition = {
  tenantId: "e9ef574f-4563-4d56-ad9e-0a2d5ce42004",
  reference: "Acme Inc"
};

client.post("tenants", definition)
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

List tenants

This endpoint allows you to list Tenants.

Example

curl -i \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  https://api.serialized.io/reactions/definitions/payment-processed-email-reaction
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = ClientBuilder.newClient();
  URI apiRoot = URI.create("https://api.serialized.io");

  Map response = client.target(apiRoot)
  .path("reactions")
  .path("definitions")
  .path("payment-notifier")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .get(Map.class);
using RestSharp;
using System;

var client = new RestClient("https://api.serialized.io");

var request = new RestRequest("reactions/definitions/{reactionName}", Method.GET)
   .AddUrlSegment("reactionName", "payment-processed-email-reaction")
   .AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
   .AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");

var response = client.Execute<Dictionary<string, Object>>(request);
const axios = require("axios");

const client = axios.create({
  baseURL: "https://api.serialized.io",
  headers: {
    "Serialized-Access-Key": "<YOUR_ACCESS_KEY>",
    "Serialized-Secret-Access-Key": "<YOUR_SECRET_ACCESS_KEY>"
  }
});

client.get("reactions/definitions/payment-processed-email-reaction")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

Update tenant

This endpoint allows you to change the tenant reference.

Example

curl -i https://api.serialized.io/tenants/e9ef574f-4563-4d56-ad9e-0a2d5ce42004 \
  --header "Content-Type: application/json" \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  --data '
  {
     "reference": "A new reference"
  }
  '
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = ClientBuilder.newClient();
  URI apiRoot = URI.create("https://api.serialized.io");

  Response response = client.target(apiRoot)
  .path("tenants")
  .path("e9ef574f-4563-4d56-ad9e-0a2d5ce42004")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .put(json(Map.of("reference", "A new reference")));
using System;
using System.Collections.Generic;
using RestSharp;

var tenant = new Dictionary<string, Object>
{
    { "reference", "A new reference" }
};

var client = new RestClient("https://api.serialized.io");

var request = new RestRequest("tenants/{tenantId}", Method.PUT)
   .AddUrlSegment("tenantId", "e9ef574f-4563-4d56-ad9e-0a2d5ce42004")
   .AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
   .AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");
   .AddJsonBody(tenant);

var response = client.Execute(request);
const axios = require("axios");

const client = axios.create({
  baseURL: "https://api.serialized.io",
  headers: {
    "Serialized-Access-Key": "<YOUR_ACCESS_KEY>",
    "Serialized-Secret-Access-Key": "<YOUR_SECRET_ACCESS_KEY>"
  }
});

const definition = {
  reference: "A new reference"
};

client.put("tenants", definition)
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

Delete tenant

This endpoint permanently deletes a Tenant and all its data, including all Events, Projections, and pending Reactions.

Example

curl -i \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  -X DELETE https://api.serialized.io/tenants/e9ef574f-4563-4d56-ad9e-0a2d5ce42004
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = ClientBuilder.newClient();
  URI apiRoot = URI.create("https://api.serialized.io");

  Response response = client.target(apiRoot)
  .path("tenants")
  .path("e9ef574f-4563-4d56-ad9e-0a2d5ce42004")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .delete();
using System;
using System.Collections.Generic;
using RestSharp;

var client = new RestClient("https://api.serialized.io");

var request = new RestRequest("tenants/{tenantId}", Method.DELETE)
   .AddUrlSegment("tenantId", "e9ef574f-4563-4d56-ad9e-0a2d5ce42004")
   .AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
   .AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");

var response = client.Execute(request);
const axios = require("axios");

const client = axios.create({
  baseURL: "https://api.serialized.io",
  headers: {
    "Serialized-Access-Key": "<YOUR_ACCESS_KEY>",
    "Serialized-Secret-Access-Key": "<YOUR_SECRET_ACCESS_KEY>"
  }
});

client.delete("tenants/e9ef574f-4563-4d56-ad9e-0a2d5ce42004")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });