### Shell Example: List Groups Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to list groups using a shell command. This demonstrates making a GET request with the necessary authorization header. ```Shell curl -X GET \ 'https://coda.io/apis/admin/v1/organizations//groups' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Doc Example Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve document information using Python and Shell, including authentication and printing the document name. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs/' res = requests.get(uri, headers=headers).json() print(f'Doc name is: {res["name"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs/' | \ jq .name ``` -------------------------------- ### Get Page Information Example Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve page information using the Coda Admin API with Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs//pages/' res = requests.get(uri, headers=headers).json() print(f'Page name is: {res["name"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs//pages/' | \ jq .name ``` -------------------------------- ### Get Folder Information (Python) Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve folder details using the Coda Admin API with Python. It demonstrates setting up authentication headers and making a GET request. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//workspaces//folders/' res = requests.get(uri, headers=headers).json() print(f'Folder name is: {res["name"]}') ``` -------------------------------- ### Create Legal Hold Code Examples Source: https://coda.io/apis/admin/v1/openapi Examples for creating a legal hold using Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = f'https://coda.io/apis/admin/v1/organizations//legalHolds' payload = { 'name': 'Investigation Matter 123', 'description': 'Holding docs for legal matter 123', 'rangeStart': '2024-04-13T00:18:57.946Z', 'rangeEnd': '2024-04-13T00:18:57.946Z', 'userEmails': [ 'joe@example.com', 'jane@example.com', ] } res = requests.post(uri, headers=headers, json=payload) # => Create a new legal hold ``` ```shell curl -s -H 'Authorization: Bearer ' \ -X POST \ -H 'Content-Type: application/json' \ -d '{ "name": "Investigation Matter 123", "description": "Holding docs for legal matter 123", "rangeStart": "2024-04-13T00:18:57.946Z", "rangeEnd": "2024-04-13T00:18:57.946Z", "userEmails": [ "joe@example.com", "jane@example.com" ] }' \ 'https://coda.io/apis/admin/v1/organizations//legalHolds' ``` -------------------------------- ### Add Workspace User Example Source: https://coda.io/apis/admin/v1/openapi Python code example demonstrating how to add a user to a Coda workspace using the Admin API. It includes setting up headers, the request URI, and the JSON body with user details. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//workspaces//users' body = { 'email': 'april@example.com', 'role': 'DocMaker', } res = requests.post(uri, headers=headers, params=params, json=body).json() print(f'Added user to the workspace as a Doc Maker') ``` -------------------------------- ### List Folder Permissions Example Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to list folder permissions using Python's requests library. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//workspaces//folders//acl/permissions' res = requests.get(uri, headers=headers).json() print(f'First user with access is {res["items"][0]["principal"]["email"]}') # => First user with access is foo@bar.com ``` -------------------------------- ### Transfer User Resources Example Source: https://coda.io/apis/admin/v1/openapi Example code for transferring user resources using Python. Shows how to set up the request with authentication, endpoint, and the necessary JSON body. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//users/transferResources' body = { 'fromUser': 'joe@example.com', 'toUser': 'april@example.com', } res = requests.get(uri, headers=headers, json=body).json() print(f'Result: {res.status_code}') # => Result: 201 ``` -------------------------------- ### List Legal Holds Code Examples Source: https://coda.io/apis/admin/v1/openapi Examples for listing legal holds using Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//legalHolds' res = requests.get(uri, headers=headers).json() print(f'First legal hold\'s name is: {res["items"][0]["name"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//legalHolds' | \ jq .items[0].name ``` -------------------------------- ### Python Request for Get Legal Hold Export Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example Python code to fetch a legal hold export using the Coda Admin API. It demonstrates setting up authorization headers and making a GET request. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//legalHolds//exports/' res = requests.get(uri, headers=headers).json() print(f'Legal hold export\'s name is: {res["name"]}') ``` -------------------------------- ### Python: List Pack Configuration Permissions Source: https://coda.io/apis/admin/v1/openapi Example of how to list permissions for a Pack configuration using the Coda IO Admin V1 API in Python. It demonstrates making a GET request with authentication headers and the target URI. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//packs/configurations//permissions' # Optional parameters for pagination # params = {'limit': 10, 'pageToken': 'nextPageToken'} res = requests.get(uri, headers=headers).json() print(f'Pack configuration permissions: {res}') ``` -------------------------------- ### List Workspace Users Request Example Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to list workspace users using Python's requests library, including authorization and parameter usage. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//workspaces//users' params = { 'limit': 10, 'query': 'feature%parity', 'workspaceUserRoles': ['Admin', 'DocMaker'], 'isActivated': True } res = requests.get(uri, headers=headers, params=params).json() print(f'First user is: {res["items"][0]["email"]}') ``` -------------------------------- ### List Webhooks Request Sample Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example Python 3.13 code to list webhooks for an organization using the Coda Admin API. It demonstrates setting up authorization headers and making a GET request. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//webhooks' res = requests.get(uri, headers=headers).json() print(f'First webhook is: {res["items"][0]["name"]}') ``` -------------------------------- ### List Organization Members Code Examples Source: https://coda.io/apis/admin/v1/openapi Examples for fetching organization members using Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//groups//members' res = requests.get(uri, headers=headers).json() print(f'First user in the group is {res["items"][0]["email"]}') # => First user in the group is foo@bar.com ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//groups//members' | \ jq '.items[].email' # => "foo@bar.com", "baz@bar.com" ``` -------------------------------- ### List Organization Users Example Source: https://coda.io/apis/admin/v1/openapi Example code for listing organization users using Python and Shell. Demonstrates how to authenticate, specify the API endpoint, and parse the response. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//users' res = requests.get(uri, headers=headers, params=params).json() print(f'First user is: {res["items"][0]["email"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//users' | \ jq .items[0].email ``` -------------------------------- ### Shell Request Example Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to fetch documents from an organization using `curl` in a shell environment. It shows how to include the authorization token and the target API endpoint. ```Shell curl -H "Authorization: Bearer " https://coda.io/apis/admin/v1/organizations//docs ``` -------------------------------- ### Shell Request Example for Retrieving Document Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Provides a command-line example using 'curl' to retrieve a Coda document's information. It includes setting the Authorization header and the target URI, similar to the Python example. ```Shell curl -H "Authorization: Bearer " https://coda.io/apis/admin/v1/organizations//docs/ ``` -------------------------------- ### Python Request Example Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to fetch documents from an organization using the Coda Admin API v1 with Python's requests library. It demonstrates setting the authorization header and printing the name of the first document. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs' res = requests.get(uri, headers=headers).json() print(f'First doc is: {res["items"][0]["name"]}') ``` -------------------------------- ### Get Workspace Request Sample Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to retrieve a specific workspace using the Coda Admin API with Python. ```python import requests\n\nheaders = {'Authorization': 'Bearer '}\uri = 'https://coda.io/apis/admin/v1/organizations//workspaces/'\nres = requests.get(uri, headers=headers).json()\n\nprint(f'Workspace name is: {res["name"]}')\n ``` -------------------------------- ### List Doc Permissions Example Source: https://coda.io/apis/admin/v1/openapi Example of how to list document permissions using Python and Shell, showing how to extract the email of the first user with access. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs//acl/permissions' res = requests.get(uri, headers=headers).json() print(f'First user with access is {res["items"][0]["principal"]["email"]}') # => First user with access is foo@bar.com ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs//acl/permissions' | jq '.items[].principal.email' # => "foo@bar.com", "baz@bar.com" ``` -------------------------------- ### List Page Viewers Example Source: https://coda.io/apis/admin/v1/openapi Example of how to list page viewers for a Coda document using the Admin API with Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs//pageViewers' res = requests.get(uri, headers=headers).json() print(f'Page name is: {res["name"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs//pageViewers | \ jq .name ``` -------------------------------- ### Python Example: List Groups Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to list groups in an organization using Python's requests library. It shows how to set the authorization header and process the JSON response to access group information. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//groups' res = requests.get(uri, headers=headers).json() print(f'First group is: {res["items"][0]["name"]}') ``` -------------------------------- ### List Organizations (Python) Source: https://coda.io/apis/admin/v1/openapi Example of how to list organizations using the Coda Admin API with Python. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations' res = requests.get(uri, headers=headers).json() print(f'First org is: {res["items"][0]["name"]}') ``` -------------------------------- ### Python - Get Export Request Status Example Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example Python code using the requests library to get the status of a Coda document export request. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs//export/' res = requests.get(uri, headers=headers).json() print(f'Export status is {res["status"]}') # => Export status is InProgress ``` -------------------------------- ### Get Doc Metadata Example Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve Coda document metadata using the Admin API with Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs/' res = requests.get(uri, headers=headers).json() print(f'Doc name is: {res["name"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs/' | \ jq .name ``` -------------------------------- ### List Pack Configurations (Python) Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to list Pack configurations using the Coda Admin API with Python's requests library. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organization//packs/configurations' res = requests.get(uri, headers=headers).json() print(f'First Pack configuration is: {res["items"][0]["name"]}') ``` -------------------------------- ### Get Webhook Subscription (Shell) Source: https://coda.io/apis/admin/v1/openapi Example of retrieving a specific webhook subscription using `curl`. This snippet shows how to send a GET request and parse the response using `jq`. ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//webhooks/' | \ jq .name ``` -------------------------------- ### Get Webhook Subscription (Python) Source: https://coda.io/apis/admin/v1/openapi Example of retrieving a specific webhook subscription using Python's requests library. This snippet demonstrates sending a GET request to the webhook's endpoint. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//webhooks/' res = requests.get(uri, headers=headers).json() print(f'Webhook name is: {res["name"]}') ``` -------------------------------- ### Get Document Export Status (Shell) Source: https://coda.io/apis/admin/v1/openapi Example of checking the status of a document export request using curl and jq. It shows how to make a GET request and parse the JSON response to extract the status. ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs//export/' | \ jq '.status' # => "InProgress" ``` -------------------------------- ### List Workspaces Request Sample Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example of how to list workspaces using the Coda Admin API with Python. ```python import requests\n\nheaders = {'Authorization': 'Bearer '}\nuri = 'https://coda.io/apis/admin/v1/organizations//workspaces'\nres = requests.get(uri, headers=headers).json()\n\nprint(f'First workspace is: {res["items"][0]["name"]}')\n ``` -------------------------------- ### Get Legal Hold Export Code Samples Source: https://coda.io/apis/admin/v1/openapi Code samples for retrieving legal hold export metadata using Python and Shell. These examples show how to make the GET request and access specific fields from the response. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//legalHolds//exports/' res = requests.get(uri, headers=headers).json() print(f'Legal hold export\'s name is: {res["name"]}') ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//legalHolds//exports/' | \ jq .name ``` -------------------------------- ### Get Document Export Status (Python) Source: https://coda.io/apis/admin/v1/openapi Example of checking the status of a document export request using Python. It demonstrates how to make a GET request to the export status endpoint and retrieve the status field from the JSON response. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs//export/' res = requests.get(uri, headers=headers).json() print(f'Export status is {res["status"]}') # => Export status is InProgress ``` -------------------------------- ### Python - Get Legal Holds Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Example Python code to fetch legal holds from the Coda Admin API. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//legalHolds' res = requests.get(uri, headers=headers).json() print(f'First legal hold\'s name is: {res["items"][0]["name"]}') ``` -------------------------------- ### Create Webhook Subscription (Shell) Source: https://coda.io/apis/admin/v1/openapi Example of creating a webhook subscription using `curl`. This snippet shows how to make a POST request with authentication and a JSON payload. ```shell curl -s -H 'Authorization: Bearer ' -X POST \ 'https://coda.io/apis/admin/v1/organizations//webhooks' \ -d '{ "name": "My Webhook", "resource": "auditEvents", "target": "https://example.com/my/coda/webhook/endpoint", "filters": [{"action": "EditDoc"}, {"action": "UpdateDocPermissions"}] }' # => Create a new webhook that sends EditDoc and UpdateDocPermissions event notifications ``` -------------------------------- ### Get Organization (Python) Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve a specific organization's details using the Coda Admin API with Python. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations/' res = requests.get(uri, headers=headers).json() print(f'Org name is: {res["name"]}') ``` -------------------------------- ### Get Organization (Shell) Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve a specific organization's details using the Coda Admin API with cURL and jq. ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations/' | \ jq .name ``` -------------------------------- ### Create Webhook Subscription (Python) Source: https://coda.io/apis/admin/v1/openapi Example of creating a webhook subscription using Python's requests library. This snippet demonstrates how to send a POST request with the necessary payload and headers. ```python import requests headers = {'Authorization': 'Bearer '} uri = f'https://coda.io/apis/admin/v1/organizations//webhooks' payload = { 'name': 'My Webhook', 'resource': 'auditEvents', 'target': 'https://example.com/my/coda/webhook/endpoint', 'filters': [ {'action': 'EditDoc'}, {'action': 'UpdateDocPermissions'}, ], } res = requests.post(uri, headers=headers, json=payload) # => Create a new webhook that sends EditDoc and UpdateDocPermissions event notifications ``` -------------------------------- ### Get Document Export Status Code Samples Source: https://coda.io/apis/admin/v1/openapi Provides code examples for retrieving the document export status using Python and Shell. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs//export/' res = requests.get(uri, headers=headers).json() print(f'Export status is {res["status"]}') # => Export status is InProgress ``` ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//docs//export/' | \ jq '.status' # => "InProgress" ``` -------------------------------- ### Get Folder Information (Shell) Source: https://coda.io/apis/admin/v1/openapi Example of how to retrieve a folder's name using `curl` and `jq` in a shell environment. This showcases making an authenticated API call and parsing the JSON response. ```shell curl -s -H 'Authorization: Bearer ' \ 'https://coda.io/apis/admin/v1/organizations//workspaces//folders/' | \ jq .name ``` -------------------------------- ### List Doc Pack Connections Code Sample Source: https://coda.io/apis/admin/v1/openapi Python code sample for listing Coda document Pack connections. ```python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs/packConnections' params = { 'readAccess': 'Anyone', } res = requests.get(uri, headers=headers, params=params).json() print(f'First connection is for Pack: {res["items"][0]["pack"]["id"]}') # => First connection is for Pack: # => 1003 ``` -------------------------------- ### Get Doc Metadata Source: https://coda.io/apis/admin/v1/openapi Retrieves metadata for a specific Coda document. This operation is deprecated. Authentication is required, and the response contains document details, with examples showing how to access the document's name. ```APIDOC GET /organizations/{organizationId}/docs/{docId} Summary: Get doc metadata Description: Returns metadata for a specific doc OperationId: getDoc Tags: Docs Parameters: - $ref: '#/components/parameters/organizationId' - $ref: '#/components/parameters/docId' Responses: '200': description: Metadata for the doc. content: application/json: schema: $ref: '#/components/schemas/Doc' '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/UnauthorizedError' '403': $ref: '#/components/responses/ForbiddenError' '404': $ref: '#/components/responses/NotFoundError' '429': $ref: '#/components/responses/TooManyRequestsError' ``` -------------------------------- ### Export Document (Python) Source: https://coda.io/apis/admin/v1/openapi Example of initiating a document export using Python's requests library. It demonstrates setting up headers, the request URI, and the payload for the export request. ```python import requests headers = {'Authorization': 'Bearer '} uri = f'https://coda.io/apis/admin/v1/organizations//docs//export' payload = { 'format': 'PDF', 'isLandscape': 'false', 'paperSize': 'Letter', } res = requests.post(uri, headers=headers, json=payload) print(f'Request ID for tracking the export is: {res["id"]}') # => Request ID for tracking the export is: # 85d2fb03-2747-44c4-8b3b-7a05d37eec04 ``` -------------------------------- ### List Organization Docs Source: https://coda.io/apis/admin/v1/openapi Retrieves a list of Coda documents within a specified organization. Supports filtering by installed pack count and fetching permissions mode. Includes examples for Python and Shell. ```APIDOC GET /organizations/{organizationId}/docs Parameters: - name: includeInstalledPackCount description: Include the count of installed packs in the response. in: query required: false schema: type: boolean - name: fetchPermissionsMode description: >- How to fetch permissions for a doc. Defaults to list all permissions. in: query required: false schema: $ref: '#/components/schemas/FetchPermissionsMode' Responses: '200': description: List of Coda docs. content: application/json: schema: $ref: '#/components/schemas/DocList' '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/UnauthorizedError' '403': $ref: '#/components/responses/ForbiddenError' '404': $ref: '#/components/responses/NotFoundError' '429': $ref: '#/components/responses/TooManyRequestsError' ``` -------------------------------- ### List Doc Permissions (Python) Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Provides an example of how to retrieve a list of all permissions for a specific Coda document using the Admin API v1. It shows how to make a GET request and access the principal's email from the response. ```Python import requests\n\nheaders = {'Authorization': 'Bearer '}\uri = 'https://coda.io/apis/admin/v1/organizations//docs//acl/permissions'\nres = requests.get(uri, headers=headers).json()\n\nprint(f'First user with access is {res["items"][0]["principal"]["email"]}')\n# => First user with access is foo@bar.com ``` -------------------------------- ### Python Request Example for Retrieving Document Source: https://coda.io/apis/admin/v1/developers/apis/admin/v1 Demonstrates how to use the Python 'requests' library to fetch a Coda document's details. It sets the authorization header with an API token and makes a GET request to the specified URI, then prints the document's name from the JSON response. ```Python import requests headers = {'Authorization': 'Bearer '} uri = 'https://coda.io/apis/admin/v1/organizations//docs/' res = requests.get(uri, headers=headers).json() print(f'Doc name is: {res["name"]}') ```