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


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

    res = g_client.client.collections.update(name="<value>", id=330922, added_roles=[
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.VERIFIER,
        ),
    ], removed_roles=[
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.EDITOR,
        ),
        models.UserRoleSpecification(
            person=models.Person(
                name="George Clooney",
                obfuscated_id="abc123",
            ),
            role=models.UserRole.EDITOR,
        ),
    ], audience_filters=[
        {
            "field_name": "type",
            "values": [
                {
                    "value": "Spreadsheet",
                    "relation_type": models.RelationType.EQUALS,
                },
                {
                    "value": "Presentation",
                    "relation_type": models.RelationType.EQUALS,
                },
            ],
        },
    ])

    # Handle response
    print(res)
{
  "permissions": {
    "write": {
      "scopeType": "GLOBAL",
      "create": true,
      "update": true,
      "delete": true
    }
  },
  "id": 123,
  "createTime": "2023-11-07T05:31:56Z",
  "updateTime": "2023-11-07T05:31:56Z",
  "creator": {
    "name": "George Clooney",
    "obfuscatedId": "abc123"
  },
  "updatedBy": {
    "name": "George Clooney",
    "obfuscatedId": "abc123"
  },
  "itemCount": 123,
  "childCount": 123,
  "items": [
    {
      "name": "<string>",
      "description": "<string>",
      "icon": "<string>",
      "collectionId": 123,
      "documentId": "<string>",
      "url": "<string>",
      "itemId": "<string>",
      "createdBy": {
        "name": "George Clooney",
        "obfuscatedId": "abc123"
      },
      "createdAt": "2023-11-07T05:31:56Z",
      "document": {},
      "shortcut": {
        "id": 123,
        "inputAlias": "<string>",
        "destinationUrl": "<string>",
        "destinationDocumentId": "<string>",
        "description": "<string>",
        "unlisted": true,
        "urlTemplate": "<string>",
        "addedRoles": [
          {}
        ],
        "removedRoles": [
          {}
        ],
        "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": [
          {}
        ]
      },
      "collection": "<any>",
      "itemType": "DOCUMENT"
    }
  ],
  "pinMetadata": {
    "existingPins": [
      {
        "category": "COMPANY_RESOURCE",
        "value": "<string>",
        "target": "RESOURCE_CARD"
      }
    ],
    "eligiblePins": [
      {
        "id": 123,
        "target": {
          "category": "COMPANY_RESOURCE",
          "value": "<string>",
          "target": "RESOURCE_CARD"
        }
      }
    ]
  },
  "shortcuts": [
    "<string>"
  ],
  "children": [
    "<any>"
  ],
  "roles": [
    {}
  ],
  "errorCode": "NAME_EXISTS",
  "collection": {
    "permissions": {
      "write": {
        "scopeType": "GLOBAL",
        "create": true,
        "update": true,
        "delete": true
      }
    },
    "id": 123,
    "createTime": "2023-11-07T05:31:56Z",
    "updateTime": "2023-11-07T05:31:56Z",
    "creator": {
      "name": "George Clooney",
      "obfuscatedId": "abc123"
    },
    "updatedBy": {
      "name": "George Clooney",
      "obfuscatedId": "abc123"
    },
    "itemCount": 123,
    "childCount": 123,
    "items": [
      {
        "name": "<string>",
        "description": "<string>",
        "icon": "<string>",
        "collectionId": 123,
        "documentId": "<string>",
        "url": "<string>",
        "itemId": "<string>",
        "createdBy": {
          "name": "George Clooney",
          "obfuscatedId": "abc123"
        },
        "createdAt": "2023-11-07T05:31:56Z",
        "document": {},
        "shortcut": {
          "id": 123,
          "inputAlias": "<string>",
          "destinationUrl": "<string>",
          "destinationDocumentId": "<string>",
          "description": "<string>",
          "unlisted": true,
          "urlTemplate": "<string>",
          "addedRoles": [
            {}
          ],
          "removedRoles": [
            {}
          ],
          "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": [
            {}
          ]
        },
        "collection": "<any>",
        "itemType": "DOCUMENT"
      }
    ],
    "pinMetadata": {
      "existingPins": [
        {
          "category": "COMPANY_RESOURCE",
          "value": "<string>",
          "target": "RESOURCE_CARD"
        }
      ],
      "eligiblePins": [
        {
          "id": 123,
          "target": {
            "category": "COMPANY_RESOURCE",
            "value": "<string>",
            "target": "RESOURCE_CARD"
          }
        }
      ]
    },
    "shortcuts": [
      "<string>"
    ],
    "children": [
      "<any>"
    ],
    "roles": [
      {}
    ]
  },
  "error": {
    "errorCode": "NAME_EXISTS"
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Collection content plus any additional metadata for the request.

The body is of type object.

Response

200
application/json

OK

The response is of type object.