Viewing, creating, updating and managing data sources.

GET /datasources

Description

Get a list of all the data sources to which the user has access.

Permissions

dashboard.library

Resource URL

https://app.klipfolio.com/api/1.0/datasources

Parameters

client_id={id}

Example Request

GET https://app.klipfolio.com/api/1/datasources?client_id=0123456789abcdef0123456789abcdef

Example Response

{
  "meta": {
    "success": true,
    "status": 200,
    "count": 4,
    "total": 4
  },
  "data": {
    "datasources": [
      {
        "id": "c98bad42a8c8a63e0b5e6c0f7aca9898",
        "name": "Example: Marketing Web Analytics",
        "description": "Sample data you can use when trying out Klipfolio. This is an example of typical web analytics data that you might pull out of services like Google Analytics, GoSquared or Adobe Analytics.",
        "refresh_interval": 0,
        "date_last_refresh": "2016-06-17T13:33:57Z",
        "is_dynamic": false
      },
     
    ]
  }
}

GET /datasources/{id}

Description

Get the details for the specific data source id.

Permissions

dashboard.library

Resource URL

https://app.klipfolio.com/api/1.0/datasources/{id}

Parameters

id={datasource id}

Example Request

GET https://app.klipfolio.com/api/1/datasources/0123456789abcdef0123456789abcdef

Example Response

{
  "data": {
       "id":"0123456789abcdef0123456789abcdef",
       "company":"Self",
       "name":"Sample Datasource",
       "description":"Datasource sample details",
       "connector":"google_adwords",
       "format":"csv",
       "refresh_interval":432000,
       "created_by":"98765432109876543210987654321",
       "is_dynamic":false,
       "disabled":false,
       "date_created":"2014-11-04T20:26:22Z",
       "date_last_refresh":"2014-11-12T21:43:10Z"
  },
  "meta": {
      "status": 200,
      "success": true
  }

POST /datasources

Description

Create a data source. Data source properties can optionally be specified in the post data.

Permissions

datasource.create

Resource URL

https://app.klipfolio.com/api/1.0/datasources/{id}

Fields

name, description, format, connector, refresh_interval, properties, client_id (optional)

Where connector could be: 'box', 'comscore', 'db', 'dropbox', 'facebook', 'ftp', 'google_adwords', 'google_analytics', 'google_drive', 'google_spreadsheets', 'hubspot', 'iformbuilder', 'marketo', 'omniture', 'radian6', 'salesforce', 'searchMetrics', 'shopify', 'simple_rest', 'survey_monkey', 'versature', 'xero', 'xmla'

Example Requests

Note: optionally include 'client_id' in the post data to create a data source for a client.

POST https://app.klipfolio.com/api/1/datasources -d
“{'name': 'Example','description': 'This is a new data source', 'format': 'xml', 'connector': 'simple_rest', 'refresh_interval': 1800, 'properties': {'endpoint_url': 'http://test/data/scatter.xml', 'method': 'GET'}}”

This is an example request for a Google Analytics dynamic data source:

POST https://app.klipfolio.com/api/1/datasources -d "{'name': 'Test', 'description': 'Test', 'connector': 'google_analytics', 'format': 'csv', 'refresh_interval': 12345, 'properties': { 'endpoint_url': 'https://www.googleapis.com/analytics/v3/data/ga\?ids=ga:{props.profile_id}\&dimensions=ga:deviceCategory,ga:date\&metrics=ga:sessions\&start-date={date.add(-365).format()}\&end-date={date.today}\&max-results=10000', 'oauth_provider_id': 'google20', 'oauth_user_header': '123456abcdefg123456abcdef1234abcd12ab1234abcd', 'oauth_user_token': 'ab12.Ai-aA1G23BcD4EF5gHijk678lMNOpqrSTu-vW_x9Yzabcd1Efghij2kl3m4_N5OPQjQ', 'token_id': '123ab45c6a123b123a1abc1234abc12b1', 'prop:profile_id': '123456789'}}"

Example Response

Note that both the data source id and the corresponding data source instance id is returned.

{
 "meta": {
   "success": true,
   "status": 201,
   "location": "/datasources/5d8821caa9ac3b2a291496e182de13e2",
   "instance_location": "/datasource_instances/5d8821caa9ac3b2a291496e182de13e2"
 },
 "data": { }
}

PUT /datasources/{id}

Description

Update the specified data source.

Permissions

datasource.edit

Resource URL

https://app.klipfolio.com/api/1.0/datasources

Fields

name, description, refresh_interval

Example Request

PUT https://app.klipfolio.com/api/1/datasources/8ea607c46ba6a7ba6e4c16ee292d7608 -d
"{'name': 'Updated Data Source Name',
'description': 'This is cool info',
'refresh_interval': 14400}"

Example Response:

{ "meta": { "success": true, "status": 200 }, "data": { } }

Note: Use Data Source Instances Data to update the specified data source with data.

DELETE /datasources/{id}

Description

Delete the data source associated with a specific data source ID.

Permissions

datasource.delete

Resource URL

https://app.klipfolio.com/api/1.0/datasources/{id}

Parameters

id={datasource id}

Example Request

DELETE https://app.klipfolio.com/api/1/datasources/0123456789abcdef0123456789abcdef

Example Response

{
"data": {},
"meta": {
    "status": 200,
    "success": true
}
}