ioet / time-tracker-backend

API to provide data to the time tracker project
5 stars 0 forks source link

End point make a user an administrator #229

Open scastillo-jp opened 4 years ago

scastillo-jp commented 4 years ago

make a user an administrator, is necessary create a new end point for this feature.

Angeluz-07 commented 4 years ago

We encountered that for the HTTP method PATCH to work, we need to add headers explicitly, e.g.:

        headers = {
            'Content-type': 'application/json',
            'Accept': 'application/json',
        }
        endpoint = "{endpoint}/users/{user_id}?api-version=1.6".format(
            endpoint=self.config.ENDPOINT, user_id=id
        )
        data = {'extension_1d76efa96f604499acc0c0ee116a1453_role': role}
        response = requests.patch(
            endpoint,
            auth=BearerAuth(self.access_token),
            data=json.dumps(data),
            headers=headers,
        )