Batch Create Warrants Warrant Cloud Only
Create up to 100 new warrants in one API request.
Endpoint
POST /v2/warrants
Request
Body
A list
of warrant
s (as defined in the create warrant API).
note
Each batch create request can create up to 100 new warrants. Requests containing more than 100 warrants will fail.
Batch creates are atomic operations. If any error (client or server) is encountered during creation, none of the warrants will be created. Batch create requests can therefore be safely retried.
- cURL
- Go
- Java
- Node.js
- PHP
- Python
- Ruby
POST /v2/warrants
curl "https://api.warrant.dev/v2/warrants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'[
{
"objectType": "report",
"objectId": "avk2837",
"relation": "viewer",
"subject": {
"objectType": "user",
"objectId": "5djfs6"
}
},
{
"objectType": "report",
"objectId": "slp1029",
"relation": "viewer",
"subject": {
"objectType": "user",
"objectId": "8lnsp7"
}
}
]'
POST /v2/warrants
createdWarrants, err := warrant.BatchCreate([]warrant.WarrantParams{
{
ObjectType: "report",
ObjectId: "avk2837",
Relation: "member",
Subject: warrant.Subject{
ObjectType: "user",
ObjectId: "5djfs6"
},
},
{
ObjectType: "report",
ObjectId: "slp1029",
Relation: "member",
Subject: warrant.Subject{
ObjectType: "user",
ObjectId: "8lnsp7",
},
},
})
POST /v2/warrants
Warrant[] createdWarrants = client.createWarrants(new Warrant[]{
new Warrant("report", "avk2837", "member", new WarrantSubject("user", "5djfs6")),
new Warrant("report", "slp1029", "member", new WarrantSubject("user", "8lnsp7"))
});
POST /v2/warrants
const createdWarrants = await warrantClient.Warrant.batchCreate([
{
"objectType": "report",
"objectId": "avk2837",
"relation": "viewer",
"subject": {
"objectType": "user",
"objectId": "5djfs6"
}
},
{
"objectType": "report",
"objectId": "slp1029",
"relation": "viewer",
"subject": {
"objectType": "user",
"objectId": "8lnsp7"
}
}
]);
POST /v2/warrants
created_warrants = warrant.Warrant.batch_create([
{"objectType": "report", "objectId": "avk2837", "relation": "member", "subject": {"objectType": "user", "objectId": "5djfs6"}},
{"objectType": "report", "objectId": "slp1029", "relation": "member", "subject": {"objectType": "user", "objectId": "8lnsp7"}},
])
POST /v2/warrants
created_warrants = Warrant::Warrant.batch_create([
{ object_type: "report", object_id: "avk2837", relation: "viewer", subject: { object_type: "user", object_id: "5djfs6" } },
{ object_type: "report", object_id: "slp1029", relation: "viewer", subject: { object_type: "user", object_id: "8lnsp7" } }
])
Response
Headers
Warrant-Token string
A unique transaction identifier for this write operation. Can be cached and passed on subsequent read requests.
200 OK
[
{
"objectType": "report",
"objectId": "avk2837",
"relation": "viewer",
"subject": {
"objectType": "user",
"objectId": "5djfs6"
}
},
{
"objectType": "report",
"objectId": "slp1029",
"relation": "viewer",
"subject": {
"objectType": "user",
"objectId": "8lnsp7"
}
}
]