Skip to main content
After you have configured the authentication and reports, you are ready to define how to process the data returned from the API endpoint. This is the hardest part of writing a custom connector, but with a little JavaScript knowledge, you can do it! Once you have defined how the data will be processed, you can verify that the data was processed correctly by sending your generated data to Domo. This tutorial will provide an overview of the flow you usually need to follow when processing data (including tips on writing and debugging your code) and several examples for you to look through. The Connector Dev Studio has several built-in functions to make the process easier for you. For a list of these built-in JavaScript functions, see Reference.

Overview


In this section, you can handle API calls and return results as you wish. However most custom connectors will follow this general pattern. For each report:
  1. Compose the https URL, request parameters, and request header as required for the report by your API endpoint. Call the API endpoint, and retrieve the data.
  2. Parse the data. You will need to know how the data from your endpoint will be returned.
    • Websites frequently return data in .json, .xml, and .csv formats.
      • If you need to examine the data returned from your API endpoint, try making the call in a tool like Postman. You can also print the response in your browser’s console by using the console.log function.
  3. Store the data in Domo.
    • If your website is returning data in a compatible format, you may be able to use one of the built-in magic Parse functions which will parse and store the data in one simple call.
      • If magicParse is not an option, first define the columns with a column name and data type, then add the data, one row at a time, one cell at a time. See Examples.
      • When adding a row, remember to call datagrid.endRow() when the row is complete.
      • Dates inserted into the table need to be formatted yyyy-MM-dd’T’HH:mm:ss.
      • If your endpoint paginates its data, you may need to make multiple API calls to get all the data.
  • Ensure the script runs inECMA Strict Modeto avoid any unexpected behavior.
  • Click Run Script anytime you want to test your code.
  • Print large amounts of data in your browser’s console by using theconsole.logfunction.
  • You can use DOMO.log(), console.log(), andto help you debug your JavaScript and examine variables. Just remove what you don’t need before you submit your custom connector.

Send Data to Domo


After you have defined how the data will be processed, you can verify if the data is correctly represented in Domo by sending your generated data to Domo.
  1. Check Create/Update Dataset.
  2. Click Run Script. A success or error message about the process will appear next to the Run Script button.
  3. If successful, the dataset will be published in your Domo instance. A pop-up window will provide a link directly to the dataset (this may be blocked by a pop-up blocker).
In your Domo instance, you can verify that your datatypes and values are correct. Note: These datasets cannot be scheduled. The connector must be published to schedule dataset updates.
User-Data-Center

Examples


The Connector Dev Studio has a couple of example connectors provided to you: Sample CRM and USGS.
  • The Sample CRM connector pulls fake data from an API endpoint provided by Domo.
  • The USGS connector pulls data available from theUnited States Geological Survey.
The following examples of data processing blocks are pulled from these sample connectors.
Sample Custom Connector

SampleCRM

Authentication type: Username and password Reports: Opportunities Parameters: None Endpoint data return format: CSV

SampleCRM using datagrid.magicParseCSV

  • Authentication type: Username and password
  • Reports: Opportunities
  • Parameters: None
  • Endpoint data return format: CSV

USGS

  • Authentication type: None
  • Reports: Past Hour, Past Day, Past 7 Days, Past 30 Days, Pull data from the last X day(s)
  • Parameters: None
  • Endpoint data return format: JSON