Create a Data Source (REST API: POST)

Updated

This operation creates a new data source in Data Cube.

Request

Syntax

POST <webservice>/dcube/createDataSource HTTP/1.1

Host: <host name>

Accept: application/xml

Authtoken: <authentication token>

<create_data_source_template.xml>

where <webservice> is the root path used to route the API requests to the Web Server.

For more information, see Available Web Services for REST API.

Request Headers

Name

Description

Host

The host name of the Web Server or the Web Console that is used in the API request.

Accept

The format of the response.

Valid values are: application/xml.

Authtoken

The authentication token that is received after successfully logging on.

For details on receiving an authentication token, see Authentication.

Request Body

Download the create_data_source_template.xml file that is required for this request. The following table shows the parameters for the create_data_source_template.xml file.

Parameter

Description

Element

Parent Element

collectionName

The name of the new open data source.

collectionReq

DM2ContentIndexing_CreateDataSourceReq

cloudID

The Index Server ID that you want to use to create the data source.

If you don't know the Index Server ID, then you can use the View Index Servers (REST API: GET)to retrieve it.

ciserver

collectionReq

dataSourceName

The name of the data source.

dataSource

DM2ContentIndexing_CreateDataSourceReq

dataSourceType

The type of data source that you want to create.

Valid values are:

  • 1: Database

  • 2: Web site

  • 3: CSV

  • 5: File system

  • 8: Salesforce

  • 9: LDAP

  • 10: Federated Search

  • 11: Open data source

  • 12: HTTP

dataSource

DM2ContentIndexing_CreateDataSourceReq

description

An optional description of the data source.

dataSource

dDM2ContentIndexing_CreateDataSourceReq

Example

Example Request - Create File System Data Source

POST <webservice>/dcube/createDataSource HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

<DM2ContentIndexing_CreateDataSourceReq>

  <collectionReq collectionName="FSSample">

    <ciserver cloudID="1"/>

  </collectionReq>

  <dataSource datasourceName="FSSample" datasourceType="5" description="Sample FS Datasource" attribute="0">

    <properties propertyName="includedirectoriespath" propertyValue="\\share.company.com\dept-docs"/>

    <properties propertyName="includefilters" propertyValue=""/>

    <properties propertyName="excludefilters" propertyValue=""/>

    <properties propertyName="doincrementalscan" propertyValue="false"/>

    <properties propertyName="username" propertyValue="domain\username"/>

    <properties propertyName="password" propertyValue="YnDvs3lciExMg0K"/>

    <properties propertyName="pushonlymetadata" propertyValue="true"/>

    <properties propertyName="minumumdocumentsize" propertyValue="0"/>

    <properties propertyName="maximumdocumentsize" propertyValue="52428800"/>

  </dataSource>

</DM2ContentIndexing_CreateDataSourceReq>

Example Request - Create Database Data Source

POST <webservice>/dcube/createDataSource HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

<DM2ContentIndexing_CreateDataSourceReq>

  <collectionReq collectionName="DBSample">

    <ciserver cloudID="1"/>

  </collectionReq>

  <dataSource datasourceName="DBSample" datasourceType="1" description="Sample FS Datasource" attribute="0">

    <properties propertyName="driver" propertyValue="com.microsoft.sqlserver.jdbc.SQLServerDriver" />

    <properties propertyName="url" propertyValue="jdbc:sqlserver://server.company.com;instanceName=commvault;databaseName=CommServ" />

    <properties propertyName="username" propertyValue="username" />

    <properties propertyName="password" propertyValue=" YnVpbsdf3lciExMg0K " />

    <properties propertyName="sql_select_statement" propertyValue="select * from dbo.SEDataSource" />

    <properties propertyName="root_entity_fields" propertyValue="[]" />

    <properties propertyName="always_incremental" propertyValue="false" />

    <properties propertyName="delta_sql_query" propertyValue="" />

    <properties propertyName="primary_key" propertyValue="" />

    <properties propertyName="delta_import_sql_query" propertyValue="" />

  </dataSource>

</DM2ContentIndexing_CreateDataSourceReq>

Example Response

<DM2ContentIndexing_GetCollectionsResp>

  <collections clientId="2" computedCoreName="DC_blank_OpenDataSourceSample_49" description="" coreName="OpenDataSourceSample" cloudId="1" ownerUserId="1" schemaType="default" createUTCTime="1489062530" coreId="49" attribute="0">

    <datasources ownerType="1" datasourceGuid="74A66100-107C-4075-ADA2-7D2123C1D9A9" description="" userId="1" datasourceType="11" datasourceId="49" createUTCTime="1489062531" attribute="0" datasourceName="OpenDataSourceSample" modifiedByUserId="1" modifiedUTCTime="1489062531" />

  </collections>

</DM2ContentIndexing_GetCollectionsResp>