Create a Tenant
Create a new tenant.
caution
This endpoint has been deprecated and will be phased out at the end of 2023. Please update any existing usages of it to use the Create Object endpoint instead.
Endpoint
POST /v1/tenants
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
tenantId | User defined string identifier for this tenant. If not provided, Warrant will create an id for the tenant and return it. In this case, you should store the id in your system for future reference. Note that tenantIds in Warrant must be composed of alphanumeric chars and/or '-', '_', and '@'. | JSON body | no |
name | An optional displayable name for this tenant. | JSON body | no |
Create a Tenant with Provided ID
Request
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
- PHP
curl "https://api.warrant.dev/v1/tenants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{"tenantId":"d6ed6474-784e-407e-a1ea-42a91d4c52b9", "name": "Dunder Mifflin"}'
tenant, err := tenant.Create(&warrant.TenantParams{
TenantId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
Name: "Dunder Mifflin",
})
Map<String, Object> tenantMeta = new HashMap<String, Object>();
tenantMeta.put("name", "Dunder Mifflin");
Tenant tenant = client.createTenant(new Tenant("d6ed6474-784e-407e-a1ea-42a91d4c52b9", tenantMeta));
const newTenant = await warrantClient.Tenant.create({
tenantId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
meta: {
name: "Dunder Mifflin",
}
});
tenant = warrant.Tenant.create(id="d6ed6474-784e-407e-a1ea-42a91d4c52b9", meta={"name": "Dunder Mifflin"})
tenant = Warrant::Tenant.create({ tenant_id: "d6ed6474-784e-407e-a1ea-42a91d4c52b9", meta: { name: "Dunder Mifflin" } })
$tenant = $warrant->createTenant(new \Warrant\Tenant("d6ed6474-784e-407e-a1ea-42a91d4c52b9", "Dunder Mifflin"));
Response
{
"tenantId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
"name": "Dunder Mifflin"
}
Create a Tenant with Generated ID
Request
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
- PHP
curl "https://api.warrant.dev/v1/tenants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
tenant, err := client.CreateTenant(warrant.Tenant{})
tenant = client.createTenant();
const newTenant = await warrantClient.Tenant.create();
tenant = client.create_tenant()
tenant = Warrant::Tenant.create
$tenant = $warrant->createTenant(new \Warrant\Tenant());
Response
{
"tenantId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
"name": null
}