Tenants - Update
  • 22 Dec 2023
  • 1 Minute to read
  • Dark
    Light

Tenants - Update

  • Dark
    Light

Article summary

Writeable Tenant fields can be updated with the update Tenant endpoint, POST /1/tenants/{tenant_id}. The authenticated user must be a member of the Tenant to update the object.

Update Tenant

POST /1/tenants/{tenant_id}
Host: https://api.cogniac.io

Example: Updating a Tenant

curl -X POST https://api.cogniac.io/1/tenants/current \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
"name":"Cogniac Demo Updated",
"description":"Updated Description"
}' \
| json_pp
import requests
import json
from pprint import pprint

url_prefix = 'https://api.cogniac.io'
api_version = "1"
token = ''  # add your token here
headers = {'Authorization': f'Bearer {token}',
           'Content-Type': 'application/json'}
user_data = {
"name":"Cogniac Demo Updated",
"description":"Updated Description"
}

url = f'{url_prefix}/{api_version}/tenants/current'
res = requests.post(url, json=user_data, headers=headers)

if res.status_code == 200:
    response_data = json.loads(res.content)
    pprint(response_data)
else:
    print(f"Error: {res.status_code}, {res.text},{res.headers}")

For instructions on obtaining an authorization token, see Authentication.

{
  "tenant_id":"63QhzFLc9tg4",
  "name":"Cogniac Demo Updated",
  "description":"Updated Description",
  "created_at":1455044755,
  "modified_at":1455044770,
  "created_by":"test@cogniac.co"
}


Was this article helpful?