Unable to create a tenant via API, says not a valid uuid

Hi, I am trying to add a tenant using the tenant API in Wazo_authd.
Which Tenant UUID should I pass in the request and in the Wazo-Tenant Header?
Currently I have tried passing an existing tenant uuid in Wazo-Tenant header (considering this would make the existing tenant a parent to the new tenant) and a random uuid in the request parameter. But I get an error “Not a valid uuid”.

Following is my request and response:

curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ --header ‘Wazo-Tenant: 6118e18b-17e2-49ef-a59c-0759063b9548’ --header ‘X-Auth-Token: f915eb8d-694b-4809-81cf-acb29481fade’ -d ‘{ \
“address”: { \
“city”: “shimla”, \
“country”: “india”, \
“line_1”: “asdf”, \
“line_2”: “dddd”, \
“state”: “hp”, \
“zip_code”: “171006” \
}, \
“contact”: “vageesh”, \
“name”: “testnew”, \
“phone”: “8097656783”, \
“slug”: “tenant”, \
“uuid”: “6118e18b-17e2-49ef-a59c-0759063b9598” \
}’ ‘https://:443/api/auth/0.1/tenants’

Response:
{
“message”: “Not a valid UUID.”,
“error_id”: “invalid-data”,
“details”: {
“contact”: {
“message”: “Not a valid UUID.”,
“constraint_id”: “type”,
“constraint”: “uuid”
}
},
“timestamp”: 1625822228.9948983,
“resource”: “tenants”
}

Hello,

Is it your master tenant? Why do you create a tenant with the same uuid from the master tenant?

Hi @quintana ,
Sorry I was getting confused. I was confused between the UUID to be entered in the header and in the body.
I figured out that in the the header I had to enter Parent UUID and in the body I have to enter a unique UUID for the new tenant to be created.

Hello, Wazo-Tenant in the header is to permit to control children tenant from a parent tenant. So if your token is from a master tenant and you want to create a new tenant from master tenant, you don’t need to add the header. Our tenant mechanism is nested tenant. So you have the capacity to address Master Tenant → Tenant 1 and from Tenant 1 → Tenant 1 Bis and from Tenant 1 → Tenant 1 Ter. If you don’t put the uuid on the body the tenant is generated. So i think you probably don’t need it.

Hope this help you
Sylvain

Thanks @quintana , for the detailed explanation. It makes is clear. I was also assuming that UUID should be auto generated by Wazo, it makes much more sense.

1 Like