POST
/
rest
/
api
/
v1
/
updateshortcut
from glean import Glean, models
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

    res = g_client.client.shortcuts.update(id=268238, added_roles=[
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.ANSWER_MODERATOR,
        ),
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.ANSWER_MODERATOR,
        ),
    ], removed_roles=[
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.VERIFIER,
        ),
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.VERIFIER,
        ),
    ])

    # Handle response
    print(res)
{
  "shortcut": {
    "id": 123,
    "permissions": {
      "write": {
        "scopeType": "GLOBAL",
        "create": true,
        "update": true,
        "delete": true
      }
    },
    "createdBy": {
      "name": "George Clooney",
      "obfuscatedId": "abc123"
    },
    "createTime": "2023-11-07T05:31:56Z",
    "updatedBy": {
      "name": "George Clooney",
      "obfuscatedId": "abc123"
    },
    "updateTime": "2023-11-07T05:31:56Z",
    "destinationDocument": {},
    "intermediateUrl": "<string>",
    "viewPrefix": "<string>",
    "isExternal": true,
    "editUrl": "<string>",
    "alias": "<string>",
    "title": "<string>",
    "roles": [
      {}
    ]
  },
  "error": {
    "errorType": "NO_PERMISSION"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Shortcut content. Id need to be specified for the shortcut.

The body is of type object.

Response

200
application/json

OK

The response is of type object.