This article is for developers with a full understanding of how to work with our API.
Important note about the API explorer:
When you follow the link we provide to the API explorer, you'll see a red warning.
The API itself is not deprecated. It's the Google API explorer that is deprecated. All the processes described in our API articles function correctly and safely if you use this Google API explorer.
As a library administrator, you can configure custom buttons in views in your libraries. Learn more: Configure views in your library.
Important: Custom buttons can be configured by API only. This feature is not available in the administration interface.
In this article:
Automatically generated table of contents
What are custom buttons?
Custom buttons in views let users run actions that are specific to your customer's business needs. You can add custom buttons in any type of library.
For each button you can choose:
- the library and views in which the custom button is displayed
-
an icon to identify the button
-
the tooltip that appears appears on button mouseover
-
the roles to which the button is exposed
- the URL that opens when users click the button with, if required, information such as document IDs as parameters
- whether to always expose the button or to expose it only when zero documents or at least one document is selected – see below for more options
-
whether expose the button when documents with or without attachments are selected
Create custom buttons
Open the API and define the library
1. Follow this link to the AODocs API:
2. Enter the ID of the library in which you want to add custom buttons. Learn how to identify the library ID.
Define the views in which your custom button will be exposed
1. Position your cursor in the Request body field and select displayedOn in the add a property menu.
2. Select viewIds in the add a property menu within the displayedOn field.
3. Click the green plus button to add an array element. A new add a property menu appears.
4. Select id in the new add a property menu.
5. You can either:
- enter the ID of a view in which you want the button to be exposed and repeat from step 3 to define all the required views
- enter
ALL
to expose your custom button in all views in the library
Choose an icon for your custom button
1. Select icon in the add a property menu.
2. Follow this URL: https://fonts.google.com/icons?selected=Material+Icons
3. Select the required icon. A right side panel opens.
4. Under Icon font, copy the name of the selected icon.
5. In the API Explorer, paste the icon name in the icon field.
Configure a tooltip for your custom button
1. Select title in the add a property menu.
2. Enter the text you want to appear as a tooltip on your custom button.
Define the URL to open with the custom button
1. Select url in the add a property menu.
2. Enter the URL that will open when users click the button.
Note: The URL must begin with https://
3. If required, add to the URL information to send as parameters to the URL.
For example: https://www.aodocs.com/#documents=${documentIds}&userEmail=${userEmail}&userRole=${userRole}
These are the placeholders you can add:
-
domainName
: name of the user's domain (for example, demokb.aodocs.com) -
userEmail
: email address of the user (for example, alice@demokb.aodocs.com) -
userName
: display name of the user (for example, Alice Adam) -
userRole
: current user role in the library (SUPER_ADMIN
,ADMIN
,CONTRIBUTOR
, orREADER
) -
externalUser
: whether the user is external (true
orfalse
) -
locale
: current user locale in AODocs, as in the AODocs URL (en_US
,fr_FR
, and so on) -
libraryId
: current library ID -
libraryName
: current library name -
viewId
: current view ID -
viewName
: current view name -
classId
: current class ID -
className
: current class name -
stateId
: current state ID; empty when not navigating by state or no state is selected -
stateName
: current state name; empty when not navigating by state or no state is selected -
categoryValueId
: current category value ID; empty when not navigating by category -
categoryValueName
: current category value name; empty when not navigating by category or when no category selected in navigation -
categoryId
: category ID corresponding to the view navigation; empty when not navigating by category or when no category selected in navigation -
categoryName
: category name corresponding to the view navigation; empty when not navigating by category or when no category selected in navigation. -
folderId
: current folder ID, or the root folder ID if at the root of the library; empty when not navigating by folder -
folderName
: current folder name or the root folder name if at the root of the library; empty when not navigating by folder -
documentIds
: a list of the selected document IDs, separated by commas; empty if no document is selected -
withAttachmentIds
: a list of the selected document IDs with attachments, separated by commas; empty if no document with attachments is selected -
attachmentIds
: a list of the attachments of the currently selected documents in the order they appear in the attachments, separated by commas; empty if no document is selected -
folderIds
: a list of the selected folder IDs, separated by commas; empty if no folder is selected
Define the roles to which the custom button is exposed
1. Select role in the add a property menu.
2. Enter the minimum role required to see the button:
-
NONE
: the custom button is exposed to all users -
READER
-
COMMENTER
-
WRITER
-
ADMIN
-
SUPER_ADMIN
Note: You can't enter custom roles.
Define the elements to select to expose the custom button
You can define which elements the user must select for the custom button to be exposed, for example, single or multiple documents. If defined as a parameter for the URL, the IDs of any selected documents are sent as parameters to the URL that opens when the user clicks the button.
1. Select selection in the add a property menu.
2. Enter one of the following values:
-
ANY
: always displayed -
EMPTY
: displayed when the user has not selected anything -
NOT_EMPTY
: displayed when the user has selected something -
SINGLE_DOCUMENT
: displayed when the user has selected a single document - (
SINGLE_FOLDER
: displayed when the user has selected a single folder) -
SINGLE_ATTACHMENT
: displayed when the user has selected a single document with a single attachment -
ONLY_DOCUMENTS
: displayed when the user has selected one or more documents and no folders - (
ONLY_FOLDERS
: displayed when the user has selected one or more folders and no documents) -
ONLY_WITH_ATTACHMENT
: displayed when the user has selected one or more documents with attachments and no folders -
HAS_DOCUMENTS
: displayed when the user has selected one or more documents; the selection can include one or more folders -
HAS_FOLDERS
: displayed when the user has selected one or more folders; the selection can include one or more documents -
HAS_ATTACHMENTS
: displayed when the user has selected one or more documents with at least one attachment; the selection can include folders and documents without attachments
Execute the API call
Click Authorize and execute. The response is displayed in the lower part of the screen with the ID of your new custom button.
The new button is displayed in the user interface.
Delete custom buttons
To delete a custom button, you need to recover the button ID.
Recover the button ID
To do this you can either:
- Recover the button ID from the response of the API call if it's still open. Learn more: Execute the API call
- List the custom buttons in the library and copy the button ID:
- Follow this link to the AODocs API: https://apis-explorer.appspot.com/apis-explorer/?base=https://ao-docs.appspot.com/api#p/library/v1beta1/library.customuiactions.list
- Enter the library ID.
- Click Authorize and execute. The response indicates the list of custom buttons in your library.
- Select and copy the required button ID.
Delete the custom button
1. Follow this link to the AODocs API:
2. Enter the library ID. Learn how to identify the library ID.
3. Paste the custom button ID. Learn more: Recover the button ID.
4. Click Authorize and execute. The response is displayed in the lower part of the screen.