Configure custom buttons in views by API

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.
image01.png
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 on behalf of your customers. 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:

What are custom buttons?
Create custom buttons 
          Open the API and define the library
          Define the views in which your custom button will be exposed
           Choose an icon for your custom button
           'Configure a tooltip for your custom button
          Define the URL to open with the custom button
          Define the roles to which the custom button is exposed
          Define the elements to select to expose the custom button
          Execute the API call
 Delete custom buttons

 


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 press 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:

https://apis-explorer.appspot.com/apis-explorer/?base=https://ao-docs.appspot.com/api#p/library/v1beta1/library.customuiactions.create

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.

image01.png

2. Select viewIds in the add a property menu within the displayedOn field.

image02.png

3. Press the green plus button to add an array element. A new add a property menu appears.

image03.png

4. Select id in the new add a property menu.

image04.png

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
    image05a.png
  • enter ALL to expose your custom button in all views in the library
    image05b.png

Choose an icon for your custom button

1. Select icon in the add a property menu. 

image06.png

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.

image07.png

5. In the API Explorer, paste the icon name in the icon field. 

image08.png

Configure a tooltip for your custom button

1. Select title in the add a property menu.

image09.png

2. Enter the text you want to appear as a tooltip on your custom button. 

image10.png

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 press the button. 

Note: The URL must begin with https://

image11.png

3. If required, add to the URL information to send as parameters to the URL. 

For example: https://www.revevol.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, or READER)
  • externalUser: whether the user is external (true or false)
  • 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.

image12.png

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 presses 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

Note: It is not currently possible to select folders in the beta version of views, so the folder selection options (in parentheses above) are not yet available. 

image13.png

Execute the API call

Press Authorize and execute. The response is displayed in the lower part of the screen with the ID of your new custom button. 

image14.png

The new button is displayed in the user interface. 

image15.png


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: 

image16.png

Delete the custom button

1. Follow this link to the AODocs API:

https://apis-explorer.appspot.com/apis-explorer/?base=https://57-0-dot-ao-docs-staging.appspot.com/api#s/library/v1beta1/library.customuiactions.delete

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. Press Authorize and execute. The response is displayed in the lower part of the screen.

image17.png

Was this article helpful? 0 out of 0 found this helpful
If you didn’t find what you were looking for, don’t hesitate to leave a comment!
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.