Batch Create Objects Warrant Cloud Only
Create up to 100 new objects in one API request.
Endpoint
POST /v2/objects
Request
Body
A list
of objects (as defined in the create object API). Providing a objectId
for each object is optional. Warrant will generate a objectId
for all objects without a provided id.
note
Each batch create request can create up to 100 new objects. Requests containing more than 100 objects will fail.
Batch creates are atomic operations. If any error (client or server) is encountered during creation, none of the objects will be created. Batch create requests can therefore be safely retried.
- cURL
- Go
- Java
- Node.js
- PHP
- Python
- Ruby
POST /v2/objects
curl "https://api.warrant.dev/v2/objects" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'[{"objectType":"user","objectId":"d6ed6474-784e-407e-a1ea-42a91d4c52b9"},{"objectType":"user"}]'
POST /v2/objects
objects, err := object.BatchCreate([]warrant.ObjectParams{
{ObjectType: "user", ObjectId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9"},
{ObjectType: "user"},
})
POST /v2/objects
BaseWarrantObject[] objects = client.createObjects(new BaseWarrantObject[]{
new BaseWarrantObject("user", "d6ed6474-784e-407e-a1ea-42a91d4c52b9"),
new BaseWarrantObject("user")
});
POST /v2/objects
const createdObjects = await warrantClient.Object.batchCreate([
{
objectType: "user"
objectId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
},
{
objectType: "user",
},
]);
POST /v2/objects
users = warrant.Object.batch_create([
{"objectType": "user", "objectId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9"},
{"objectType": "user"},
])
POST /v2/objects
users = Warrant::Object.batch_create([
{ object_type: "user", object_id: "d6ed6474-784e-407e-a1ea-42a91d4c52b9" },
{ object_type: "user" }
])
Response
200 OK
[
{
"objectType": "user",
"objectId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9"
},
{
"objectType": "user",
"objectId": "59ed2c60-6945-42dc-b770-d3a78212ffdf"
}
]