Data APIs

Getting Started

Getting started with APIs

Domo APIs provide the secure environment you need to automate users and groups or manage data imports and exports. Domo has a wide variety of APIs, and more are always being published.

APIs are put into groups or categories of tasks that can be accomplished with the APIs. Currently we have published APIs to manage your data and users in Domo. To use any APIs you need to understand the authentication API as every API requires an authorized token to access it.

img-api

The Domo SDK

Want to write less code? The Domo Software Development Kit (SDK) streamlines the API programming experience, allowing you to significantly reduce your written code. All of the API functionality is simplified and available via the SDK.

If the SDK is not available in your preferred language, or does not meet your needs, you may write your own code against the API using the following RESTful commands.

A Simple Example

An easy way to learn more about the Domo APIs is to use a command-line http client like cURL or HTTPie. In this section we will use cURL.

Before your application can access Domo’s API, it will need an access token. You can acquire an OAuth access token by calling the OAuth Token API.

The OAuth Token API requires that you pass in Client Id and Client Secret.

  1. Click here to create a new Client Id and Client Secret.
  2. Click here to manage an existing Client Id and Client Secret.

Sample cURL Commands

Now that you have a Client Id and Client Secret you can request an OAuth access token. Make the following call replacing "your-client-id:your-client-secret" with your Client information.

curl -v "https://api.domo.com/oauth/token?grant_type=client_credentials&scope=user" -u "your-client-id:your-client-secret"

Sample Response that includes your "access token":

HTTP/1.1 : 200 OK
Cache-Control : no-cache, no-store, max-age=0, must-revalidate
Cache-Control  : no-store
Content-Type : application/json;charset=UTF-8
Date : Mon, 08 Feb 2016 20:05:04 GMT
Expires : 0
Pragma : no-cache
Pragma : no-cache
Server : Jetty(9.2.14.v20151106)
Transfer-Encoding : chunked
X-Application-Context : api:8787
X-Content-Type-Options : nosniff
X-Frame-Options : DENY
X-XSS-Protection : 1;  mode=block
{
"access_token":"eyJhbGciOiJSUzI1NiJ9.eyJyb2xlIjoiQWRtaW4iLCJzY29wZSI6WyJkYXRhIl0sImV4cCI6MTQ1NzMyMTcxMywiZW52IjoiZGV2MyIsInVzZXJJZCI6NzQ2ODMwODk3LCJqdGkiOiI1NGRmYjYxNy02ZWUyLTRhMTgtOTBkMC03OTc5MzIxMjk2ZjEiLCJjbGllbnRfaWQiOiI1ZTRlNjI1Yi1hOTU0LTQ5ZjYtOGYzMC1kMDBjYTcyOGJlNmUiLCJjdXN0b21lciI6ImRldiJ9.Wqg6BeiAMelGs0cFsB_Nx7xj-Vpz6iODxtDy8Pi8-nEji_4wW85nT67sf-BG2714i-tfsV_uuRR9T3JeMDzTOWT3VmEvwbfhAFAM32NMIh3QYRpcqu_ZS_VcopylSCQazsB1Veks8_ND2-VY7yFrcawLtwbAsOxN8uD0LCHp-7F3pROPQEciJXaUyur6B9piT7-yve5hdwz4YDNMA9T27JsaoSUcqwp5NLy8eRizsB6WaYIjuFw3Ad1iFw47KOUhLxEUQg4JZDocrMCWcyTk_Oe4stAp4YeOWoxnIeO3c-4NzRUexPWocHcFA8SBMed3p6gw3K8Krurd1yhI0ZEgYA",
"token_type":"bearer",
"expires_in":43199,
"scope":"data",
"customer":"dev",
"env":"dev3",
"userId":746830890,
"role":"Admin",
"jti":"54dfb617-6ee2-4a18-90d0-7979321296f1"}
}

Everything after the "access_token": and up to the closing " is your OAuth Token.

Now use your valid OAuth Token to call any API in Domo. For this example we will cal the "list users" API.

curl "https://api.domo.com/v1/users" -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: bearer your-valid-oauth-access-token"

Sample Response

HTTP/1.1 200 OK
Server: nginx
Date: Sun, 06 Mar 2016 16:01:36 GMT
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY

[{"id":535460005,"title":"Director","email":"Alan.Smith@domo.com","role":"Admin","phone":"801-777-8456","name":"Alan Smith","links":[{"rel":"self","href":"https://api.domo.com/v1/users/535460005"}]},{"id":1845705061,"title":null,"email":"Aaron.Farside@domo.com","role":"Admin","phone":null,"name":"Aaron Farside","links":[{"rel":"self","href":"https://api.domo.com/v1/users/1845705061"}]},{"id":47253114,"title":"","email":"Art.Allen@domo.com","role":"Admin","phone":"8014776666","name":"Art 1 (admin)","links":[{"rel":"self","href":"https://api.domo.com/v1/users/47253114"}]}]

NOTE: Make sure the access you request includes the scope desired. For example, in this example we requested "scope=user" so we could call the list user API. If you want to call the list Data API then you would need to request "scope=data".