Reaction API reference

Full reference for the Reaction API

Create reaction definition

Create a new reaction definition

Example

curl -i https://api.serialized.io/reactions/definitions \
  --header "Content-Type: application/json" \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  --data '
  {
    "reactionName": "payment-processed-email-reaction",
    "feedName": "payment",
    "reactOnEventType": "PaymentProcessed",
    "action": {
      "actionType": "HTTP_POST",
      "targetUri": "https://your-email-service"
    }
  }
  '
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> reactionDefinition = ImmutableMap.of(
  "reactionName", "payment-processed-email-reaction",
  "feedName", "payment",
  "reactOnEventType", "PaymentProcessed",
  "action", ImmutableMap.of(
  "actionType", "HTTP_POST",
  "targetUri", "https://your-email-service"
  )
  );

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

var definition = new Dictionary<string, object>
{
    { "reactionName", "payment-processed-email-reaction" },
    { "feedName", "payment" },
    { "reactOnEventType", "PaymentProcessed" },
    { "action", new Dictionary<string, Object>
        {
            {"actionType", "HTTP_POST"},
            {"targetUri", "https://your-email-service"}
        }
    },
};

var postRequest = new RestRequest("reactions/definitions", Method.POST)
   .AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
   .AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");
   .AddJsonBody(definition);

var response = client.Execute(postRequest);
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 = {
  reactionName: "payment-processed-email-reaction",
  feedName: "payment",
  reactOnEventType: "PaymentProcessed",
  action: {
    actionType: "HTTP_POST",
    targetUri: "https://your-email-service"
  }
};

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

Get reaction definition

Get a reaction definition

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 reaction definition

Update a reaction definition

Example

curl -i https://api.serialized.io/reactions/definitions \
  --header "Content-Type: application/json" \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  -X PUT \
  --data '
  {
    "reactionName": "payment-processed-email-reaction",
    "feedName": "payment",
    "reactOnEventType": "PaymentProcessed",
    "action": {
      "actionType": "HTTP_POST",
      "targetUri": "https://your-email-service"
    }
  }
  '
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> reactionDefinition = ImmutableMap.of(
  "reactionName", "payment-processed-email-reaction",
  "feedName", "payment",
  "reactOnEventType", "PaymentProcessed",
  "action", ImmutableMap.of(
  "actionType", "HTTP_POST",
  "targetUri", "https://your-email-service"
  )
  );

  Response response = client.target(apiRoot)
  .path("reactions")
  .path("definitions")
  .path("payment-processed-email-reaction")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .put(Entity.json(reactionDefinition));
using System;
using System.Collections.Generic;
using RestSharp;

var definition = new Dictionary<string, object>
{
    { "reactionName", "payment-processed-email-reaction" },
    { "feedName", "payment" },
    { "reactOnEventType", "PaymentProcessed" },
    { "action", new Dictionary<string, Object>
        {
            {"actionType", "HTTP_POST"},
            {"targetUri", "https://your-email-service"}
        }
    },
};

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

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 = {
  reactionName: "payment-processed-email-reaction",
  feedName: "payment",
  reactOnEventType: "PaymentProcessed",
  action: {
    actionType: "HTTP_POST",
    targetUri: "https://your-email-service"
  }
};

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

Delete reaction definition

Delete a reaction definition

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/reactions/definitions/payment-notifier
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("reactions")
  .path("definitions")
  .path("payment-notifier")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .delete();
using RestSharp;
using System;

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

var request = new RestRequest("reactions/definitions/{reactionName}", Method.DELETE)
   .AddUrlSegment("reactionName", "payment-notifier")
   .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.delete("reactions/definitions/payment-notifier")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

List reaction definitions

List reaction definitions

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
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")
  .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", Method.GET)
   .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")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

List scheduled reactions

List all reactions scheduled for triggering in the future

Example

curl -i \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  https://api.serialized.io/reactions/scheduled
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("scheduled")
  .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/scheduled", Method.GET)
   .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/scheduled")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

Delete scheduled reaction

This endpoint allows you to delete a reaction that has not yet been executed.

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/reactions/scheduled/52cb6e32-e3f3-40f3-b06f-a19a08fbc19f
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("reactions")
  .path("scheduled")
  .path("52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .delete();
using RestSharp;
using System;

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

var request = new RestRequest("reactions/scheduled/{reactionId}", Method.DELETE)
   .AddUrlSegment("reactionId", "52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
   .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>"},
  headers: {"Serialized-Secret-Access-Key": "<YOUR_SECRET_ACCESS_KEY>"}
});

client.delete("reactions/scheduled/52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

Execute scheduled reaction

Execute a scheduled reaction without waiting for the trigger to fire.

Example

curl -i \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  -X POST https://api.serialized.io/reactions/scheduled/52cb6e32-e3f3-40f3-b06f-a19a08fbc19f
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("reactions")
  .path("scheduled")
  .path("52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .post(Entity.json(""));
using RestSharp;
using System;

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

var request = new RestRequest("reactions/scheduled/{reactionId}", Method.POST)
   .AddUrlSegment("reactionId", "52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
   .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.post("reactions/scheduled/52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

List triggered reactions

List all reactions that have been executed already.

Example

curl -i \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  https://api.serialized.io/reactions/triggered
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("triggered")
  .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/triggered", Method.GET)
   .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/triggered")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });

Re-executing a triggered reaction

This endpoint allows you to re-execute an already executed reaction.

Example

curl -i \
  --header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
  --header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
  -X POST https://api.serialized.io/reactions/triggered/52cb6e32-e3f3-40f3-b06f-a19a08fbc19f
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("reactions")
  .path("triggered")
  .path("52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
  .request()
  .header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
  .header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
  .post(Entity.json("");
using RestSharp;
using System;

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

var request = new RestRequest("reactions/triggered/{reactionId}", Method.POST)
   .AddUrlSegment("reactionId", "52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
   .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.post("reactions/triggered/52cb6e32-e3f3-40f3-b06f-a19a08fbc19f")
  .then(function (response) {
    // Handle response
  })
  .catch(function (error) {
    // Handle error
  });