Create an Object
Create a new object.
POST /v2/objects
Request
Body
objectType string
The type of the object (e.g. user, tenant, role, permission, etc).
objectId string
, optional
Customer defined string identifier for this object. Can only contain alphanumeric chars and/or '-', '_', '|', '@'. If not provided, Warrant will create a univerally unique identifier (UUID) for the object and return it. If allowing Warrant to generate an id, store the id in your application so you can provide it for authorization requests on that object.
meta object
, optional
A JSON object containing additional information about this object (e.g. role name/description, user email/name, etc.) to be persisted to Warrant.
- cURL
- CLI
- Go
- Java
- Node.js
- PHP
- Python
- Ruby
curl "https://api.warrant.dev/v2/objects" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{
"objectType":"user",
"objectId":"d6ed6474-784e-407e-a1ea-42a91d4c52b9"
}'
warrant object create user:d6ed6474-784e-407e-a1ea-42a91d4c52b9
user, err := object.Create(&warrant.ObjectParams{
ObjectType: "user",
ObjectId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
})
WarrantObject newUser = client.createObject(
new BaseWarrantObject("user", "d6ed6474-784e-407e-a1ea-42a91d4c52b9")
);
WarrantObject newUser = client.createObject("user", "d6ed6474-784e-407e-a1ea-42a91d4c52b9");
const newUser = await warrantClient.Object.create({
object: {
objectType: "user",
objectId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
},
});
$user = $warrant->createObject(new \Warrant\Object("user", "d6ed6474-784e-407e-a1ea-42a91d4c52b9"));
user = warrant.Object.create(object_type="user", object_id="d6ed6474-784e-407e-a1ea-42a91d4c52b9")
user = Warrant::Object.create(object_type: "user", object_id: "d6ed6474-784e-407e-a1ea-42a91d4c52b9")
Response
Body
objectType string
The type of the object (e.g. user, tenant, role, permission, etc).
objectId string
Customer defined string identifier for this object. Can only contain alphanumeric chars and/or '-', '_', '|', '@'. If not provided, Warrant will create a univerally unique identifier (UUID) for the object and return it. If allowing Warrant to generate an id, store the id in your application so you can provide it for authorization requests on that object.
meta object
A JSON object containing additional information about this object (e.g. role name/description, user email/name, etc.) to be persisted to Warrant.
{
"objectType": "user",
"objectId": "dkfi7a0s-784e-407e-a1ea-42a91d4c52b9"
}