Add connection (Overwrite the Previously Added Connection)

<< Click to Display Table of Contents >>

Current:  System Integration > WebAPI 

Add connection (Overwrite the Previously Added Connection)

Previous pageReturn to chapter overviewNext page

Request address

http://ip:port/bi/api?action=saveDbSource&token=xxxx

Request message

Request parameter

required parameter:xmlData (required)

<?xml version="1.0" encoding="utf-8"?>

<info>

 <dbsourse>

   <savepath>test connection</savepath>

   <vendor>oracle</vendor>

   <driver>oracle.jdbc.driver.OracleDriver</driver>

   <url>jdbc:oracle:thin:@192.168.1.90:1521:orcl</url>

   <user>admin</user>

   <pass>admin</pass>

   <secure>true</secure>

   <max>10</max>

   <catalog>default</catalog>

   <schema></schema>

 </dbsourse>

</info>

or

<?xml version="1.0" encoding="utf-8"?>

<info>

 <dbsourse>

   <savepath>test connection</savepath>

   <vendor>oracle</vendor>

   <driver>oracle.jdbc.driver.OracleDriver</driver>

   <url>jdbc:oracle:thin:@192.168.1.90:1521:orcl</url>

   <user>admin</user>

   <pass>admin</pass>

<secure>true</secure>

 </dbsourse>

</info>

parametric description

1)savepath(required):The name of the data source to be saved(Under the folder, is a path, such as the test/ test connection)

2)vendor(required):The type of database. The parameter is:oracle, db2, sqlserver, mysql, derby, informix, sybase, vertica, hive, access, analyticdb, elasticsearch, fusioninsightelk, fusioninsighthd, gaussdb100, gaussdb200, gbase, generic, greenplum, hana, hbase, hive, huaweiclouddws, impala, kingbase, kylin, maxcompute, postgresql, presto, spark, teradata, thunderengine, transwarp, oracleessbase, sapbw, ssas, mongo.

3)driver(required):Database corresponding driver

4)url(required):Url link

5)user(optional):user name for connecting to the database

6)pass(optional):password for connecting to the database

7)secure(required):true,Indicates that permission validation is required-check,false,Indicates that permission validation is required-unchecked.

8)schema(optional):Represents a table structure schema. This parameter can not be written

9)catalog(optional):Represents the default database. This parameter can not be written.

10)  If the savepath added twice is consistent, this method overrides the previously added data source.

Sample

function addDbSource() {

        var xml = getXml();

        $.post("http://" + ip + ":" + port + "/" + project + "/api?action=saveDbSource&token=xxxx",

           {xmlData : xml},

           function(result) {        

              writeXml(result);

           });

     }

Response message

Response result

 

1)Successful operation

<?xml version="1.0" encoding="utf-8"?>

<results>

 <result>

   <level>1</level>

   <message>Add successfully.</message>

 </result>

</results>

2)Operation failure

<?xml version="1.0" encoding="UTF-8"?>

<results>

  <result>

     <level>6</level><message>null</message>

  </result>

</results>

Result description

The response result information is xml. direct parse.

1) level return type, different values represent different return states, see Appendix.

2) message is the interface operation result information, when level is 1, it means that the saved successful message information is the saved data source information.