Update reaction definition
put
https://api.serialized.io
/reactions/definitions/{reactionName}
Update reaction definition

Example

cURL
Java
C#
Node
1
curl -i https://api.serialized.io/reactions/definitions \
2
--header "Content-Type: application/json" \
3
--header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
4
--header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
5
-X PUT \
6
--data '
7
{
8
"reactionName": "payment-processed-email-reaction",
9
"feedName": "payment",
10
"reactOnEventType": "PaymentProcessed",
11
"action": {
12
"actionType": "HTTP_POST",
13
"targetUri": "https://your-email-service"
14
}
15
}
16
'
Copied!
1
import com.google.common.collect.ImmutableMap;
2
import javax.ws.rs.client.Client;
3
import javax.ws.rs.client.ClientBuilder;
4
5
Client client = ClientBuilder.newClient();
6
URI apiRoot = URI.create("https://api.serialized.io");
7
8
Map<String, Object> reactionDefinition = ImmutableMap.of(
9
"reactionName", "payment-processed-email-reaction",
10
"feedName", "payment",
11
"reactOnEventType", "PaymentProcessed",
12
"action", ImmutableMap.of(
13
"actionType", "HTTP_POST",
14
"targetUri", "https://your-email-service"
15
)
16
);
17
18
Response response = client.target(apiRoot)
19
.path("reactions")
20
.path("definitions")
21
.path("payment-processed-email-reaction")
22
.request()
23
.header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
24
.header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
25
.put(Entity.json(reactionDefinition));
Copied!
1
using System;
2
using System.Collections.Generic;
3
using RestSharp;
4
5
var definition = new Dictionary<string, object>
6
{
7
{ "reactionName", "payment-processed-email-reaction" },
8
{ "feedName", "payment" },
9
{ "reactOnEventType", "PaymentProcessed" },
10
{ "action", new Dictionary<string, Object>
11
{
12
{"actionType", "HTTP_POST"},
13
{"targetUri", "https://your-email-service"}
14
}
15
},
16
};
17
18
var request = new RestRequest("reactions/definitions/{reactionName}", Method.PUT)
19
.AddUrlSegment("reactionName", "payment-processed-email-reaction")
20
.AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
21
.AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");
22
.AddJsonBody(definition);
23
24
var response = client.Execute(request);
Copied!
1
const axios = require("axios");
2
3
const client = axios.create({
4
baseURL: "https://api.serialized.io",
5
headers: {"Serialized-Access-Key": "<YOUR_ACCESS_KEY>"},
6
headers: {"Serialized-Secret-Access-Key": "<YOUR_SECRET_ACCESS_KEY>"}
7
});
8
9
const definition = {
10
reactionName: "payment-processed-email-reaction",
11
feedName: "payment",
12
reactOnEventType: "PaymentProcessed",
13
action: {
14
actionType: "HTTP_POST",
15
targetUri: "https://your-email-service"
16
}
17
};
18
19
client.put("reactions/definitions/payment-processed-email-reaction", definition)
20
.then(function (response) {
21
// Handle response
22
})
23
.catch(function (error) {
24
// Handle error
25
});
Copied!
Last modified 10mo ago