Put request not working

Good afternoon,

Has anyone used a PUT request for tenantPermission in a datastore?

python

CopyEdit

import requests

url = "https://changeme/api/zones/zoneId/data-stores/id"

payload = {
    "datastore": {
        "visibility": "private",
        "resourcePermissions": {
            "all": True,
            "allPlans": True,
            "sites": [{"id": 1}],
            "plans": [{"id": 1}]
        },
        "active": True,
        "tenantPermissions": [
            {
                "accounts": [1,3],
                "defaultTarget": [1, 3],
                "defaultStore": [1, 3]
            }
        ]
    }
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer xxx"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)

I would like to point out that this type of request does not work, even though the response returns a 200 status.

Hi @Khalil_Gasanov ,

We’re working on correcting the api documentation. The new changes can be seen in the dev branch of the docs here

In the meantime you have 2 options to pass these values:

  1. "tenantPermissions": [ {"id": 1, "defaultStore": true, , "defaultTarget": true}, {"id": 3, "defaultStore": true, , "defaultTarget": true} ]

  2. Or as an object like: "tenantPermissions": { "accounts": [1] }