Documentation

API Actions

Start leveraging Domo's API Actions

With the Action API you can build an automated action to trigger events across business systems, whether those actions originate in Domo or somewhere else.​

 

Create an API Action

Step 1. Login to the Connector IDE

Login to the Connector IDE at https://api.domo.com/builder/index.html#!/. When you login, the prompt asks for which Domo domain you want to develop against: enter your instance name, ex. domo.

Step 2. Click Create New and then select API Action

Step 3. Upload Connector Icons

Step 4. Enter Domo Client Key and Domo Client Secret

Step 5. Configure authentication to third party API

Step 6. Define how data is processed

Sample code:


car data = DOMO.getDataset(metadata.parameters.datasetId).queryData("select * from tbl")
Domo.log(data)
datagrid.addColumn("Response");
datagrid.addCell(JSON.stringify(data));
datagrid.endrow( );

Step 7. Submit for publishing

Domo Methods

DOMO.listDatasets();

– Returns list of all DOMO dataset IDs

DOMO.getDataset(datasetId);

– datasetID = ID of dataset within DOMO that you’d like to pull data from.

Example: let id = ”cd64fdef-6106-48c2-948a-2b5e160cad2d’;

-returns full dataset object

DOMO.queryData(datasetId, query);

-datasetId = ID of dataset within DOMO that you’d like to pull data from.

-query = the sql command you’d like to perform on returned data

Example: let query= “select * from tbl where action = ‘open'”;

Best Practice

Sample code:


let id = 'cd64fdef-6106-48c2-948a-2b5e160cad2d'; 
let query = "select * from tbl where action = 'open'"; 
let data = DOMO.getDataset(id).queryData(query);
datagrid.addColumn("Response");
datagrid.addCell(JSON.stringify(data));
datagrid.endRow();

Execute an API Action

What Actions are available?

GET

  • https://api.domo.com/v1/domoactions
  • Authorization: Bearer <your-valid-oauth-access-token>

Returns a JSON array of action objects.


[
    {
        "name": "My API Action 1 ",
        "guid": "fc1e465e-186d-4510-9d0a-dea560eef054",
        "version": 3
    },
    {
        "name": "My API Action 2",
        "guid": "c3925edd-c72b-4394-ad0c-2110dfce90b2",
        "version": 7
    },
…
]

How do I execute the Action?

POST

  • https://api.domo.com/v1/domoactions/{guid}/process?account={accountId}
    • guid: action guid from previous response
    • accountId: numerical ID associated with Domo API action account. You must have access to this account to execute the code.
  • Authorization: Bearer <your-valid-oauth-access-token>
  • Accept: application/json, application/xml, application/x-yaml or text/csv (required)
  • Content-Type: application/json
  • Body: {“datasetId”:”486718db-7ca1-4d47-9fc7-c229996c8578″}

Returns the response defined in the first cell of the datagrid of the action JavaScript.

How do I create an account?

Add an account in Data Center -> Accounts -> Add Account -> API Actions

Where do I find my account ID?

GET

  • https://api.domo.com/v1/accounts/?offset=0&limit=1
    • limit: The number of Accounts to return in the list. The default is 50 and the maximum is 500. (Optional)
    • offset: The offset of Accounts to begin the list of Accounts within the response.
  • Accept: application/json
  • Host: api.domo.com
  • Authorization: bearer <your-valid-oauth-access-token>

 

API Action FAQs

How do I create a Client ID and Secret?

Developer.domo.com -> My Account -> New Client

Where can I find the DataSet ID?

In the URL of the dataset: