How to create a new tenant on the On-Premise Orchestrator via API?
Creating a new tenant requires Host administration privileges, basically Host level access to the environment.
On the On-Premise version of Orchestrator, use the above API call - POST on "/odata/Tenants" - to create a new tenant, with the following body:
{
"Name": "TenantName",
"DisplayName": "TenantName",
"AdminPassword": "Test123@",
"LastLoginTime": null,
"IsActive": true
}
Log in to the Host tenant first, then navigate to "https://OrchestratorURL/swagger" to see all the available APIs and run the ones needed.
For running it with curl, follow the below steps:
- Authentication to the Host tenant - this will return a bearer token needed for the following API calls
curl -X POST "https://OrchestratorURL/api/Account/Authenticate" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"tenancyName\": \"host\", \"usernameOrEmailAddress\": \"admin\", \"password\": \"P@ssw0rd\"}"
- Running the API call needed: add -H "Authorization: Bearer BEARER_TOKEN" and replace BEARER_TOKEN with the output from the authentication
curl -X POST "https://OrchestratorURL/odata/Tenants" -H "Authorization: Bearer BEARER_TOKEN" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"Name\": \"TenantName\", \"DisplayName\": \"TenantName\", \"AdminPassword\": \"Test123@\", \"LastLoginTime\": null, \"IsActive\": true}"
More examples:
For a GET request:
- curl -X GET "API_ENDPOINT" -H "Authorization: Bearer BEARER_TOKEN"
For a POST request with JSON data, replace JSON_DATA with the appropriate data for your use case:
- curl -X POST "API_ENDPOINT" -H "Authorization: Bearer BEARER_TOKEN" -H "Content-Type: application/json" -d 'JSON_DATA'
For a PUT request with JSON data, replace JSON_DATA with the appropriate data for your use case:
- curl -X PUT "API_ENDPOINT" -H "Authorization: Bearer BEARER_TOKEN" -H "Content-Type: application/json" -d 'JSON_DATA'
For a DELETE request:
- curl -X DELETE "API_ENDPOINT" -H "Authorization: Bearer BEARER_TOKEN"
Note: Replace the placeholders with the actual values specific to the API and use case.