Delete all Aggregates by type

delete
Delete all aggregates by type

https://api.serialized.io/aggregates/{aggregateType}
Permanently deletes all aggregates, including all events for a given aggregate type.
Request
Response
Path Parameters
aggregateType
required
string
The aggregate type
200: OK
Delete token created successfully
{
"deleteToken": "12c3780f-2dcb-340f-5532-5693be83f21c"
}
204: No Content
Aggregate type successfully deleted
403: Forbidden
Unknown delete token

Example

This example requests a delete token for deleting all aggregates for a given type

cURL
Java
C#
Node
curl -i \
--header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
--header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
-X DELETE https://api.serialized.io/aggregates/order
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("aggregates")
.path("order")
.request()
.header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
.header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
.delete(Map.class);
String deleteToken = (String) response.get("deleteToken");
using RestSharp;
using System;
var client = new RestClient("https://api.serialized.io");
var request = new RestRequest("aggregates/order", Method.DELETE)
.AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
.AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>");
var response = client.Execute<Dictionary<string, Object>>(request);
var deleteToken = response.Data["deleteToken"]
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("aggregates/order")
.then(function (response) {
const deleteToken = response.data.deleteToken;
// Use deleteToken
})
.catch(function (error) {
// Handle error
});

Permanently deleting the aggregate type using the delete token

This example permanently deletes an aggregate type using a delete token that was returned in the response to the preceding delete request.

This is a permanent request that cannot be undone. If you need to be able to restore this data in any way you must back it up on your side before executing the deletion.

cURL
Java
C#
Node
curl -i \
--header "Serialized-Access-Key: <YOUR_ACCESS_KEY>" \
--header "Serialized-Secret-Access-Key: <YOUR_SECRET_ACCESS_KEY>" \
-X DELETE https://api.serialized.io/aggregates/order?deleteToken=12c3780f-2dcb-340f-5532-5693be83f21c
Response delete = client.target(apiRoot)
.path("aggregates")
.path("order")
.queryParam("deleteToken", deleteToken)
.request()
.header("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
.header("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
.delete();
var request = new RestRequest("aggregates/order", Method.DELETE)
.AddHeader("Serialized-Access-Key", "<YOUR_ACCESS_KEY>")
.AddHeader("Serialized-Secret-Access-Key", "<YOUR_SECRET_ACCESS_KEY>")
.AddQueryParameter("deleteToken", deleteToken);
var response = client.Execute<Dictionary<string, Object>>(request);
const requestConfig = {
params: {
deleteToken: deleteToken
}
};
client.delete("aggregates/order", requestConfig)
.then(function (response) {
// Handle response
})
.catch(function (error) {
// Handle error
});