Create a datasource
import requests
url = "https://{FUSION HOST}/api/connectors/datasources"
payload = {
"id": "test-data-source",
"parserId": "api-test-app",
"connector": "lucid.fileupload",
"type": "fileupload",
"pipeline": "api-test-app",
"properties": {
"fileId": "pokedex.json.zip",
"description": "My test datasource"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://{FUSION HOST}/api/connectors/datasources")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"test-data-source\",\n \"parserId\": \"api-test-app\",\n \"connector\": \"lucid.fileupload\",\n \"type\": \"fileupload\",\n \"pipeline\": \"api-test-app\",\n \"properties\": {\n \"fileId\": \"pokedex.json.zip\",\n \"description\": \"My test datasource\"\n }\n}")
.asString();const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'test-data-source',
parserId: 'api-test-app',
connector: 'lucid.fileupload',
type: 'fileupload',
pipeline: 'api-test-app',
properties: {fileId: 'pokedex.json.zip', description: 'My test datasource'}
})
};
fetch('https://{FUSION HOST}/api/connectors/datasources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION HOST}/api/connectors/datasources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"test-data-source\",\n \"parserId\": \"api-test-app\",\n \"connector\": \"lucid.fileupload\",\n \"type\": \"fileupload\",\n \"pipeline\": \"api-test-app\",\n \"properties\": {\n \"fileId\": \"pokedex.json.zip\",\n \"description\": \"My test datasource\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION HOST}/api/connectors/datasources"
payload := strings.NewReader("{\n \"id\": \"test-data-source\",\n \"parserId\": \"api-test-app\",\n \"connector\": \"lucid.fileupload\",\n \"type\": \"fileupload\",\n \"pipeline\": \"api-test-app\",\n \"properties\": {\n \"fileId\": \"pokedex.json.zip\",\n \"description\": \"My test datasource\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION HOST}/api/connectors/datasources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'test-data-source',
'parserId' => 'api-test-app',
'connector' => 'lucid.fileupload',
'type' => 'fileupload',
'pipeline' => 'api-test-app',
'properties' => [
'fileId' => 'pokedex.json.zip',
'description' => 'My test datasource'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://{FUSION HOST}/api/connectors/datasources \
--header 'Content-Type: application/json' \
--data '
{
"id": "test-data-source",
"parserId": "api-test-app",
"connector": "lucid.fileupload",
"type": "fileupload",
"pipeline": "api-test-app",
"properties": {
"fileId": "pokedex.json.zip",
"description": "My test datasource"
}
}
'{
"id": "test-data-source",
"created": "2024-08-02T21:00:42.165Z",
"modified": "2024-08-02T21:00:42.165Z",
"connector": "lucid.fileupload",
"type": "fileupload",
"pipeline": "api-test-app",
"parserId": "api-test-app",
"properties": {
"description": "My test datasource",
"fileId": "pokedex.json.zip",
"mediaType": "application/octet-stream"
}
}Create a datasource
Create a new datasource. The request body contains the datasource configuration properties, which depend on the connector type.
-
Use
/connectors/pluginsto get the list of installed connector types. -
Use
/connectors/schema/{type}to get the configuration properties for the connector type you want to use.
POST
/
connectors
/
datasources
Create a datasource
import requests
url = "https://{FUSION HOST}/api/connectors/datasources"
payload = {
"id": "test-data-source",
"parserId": "api-test-app",
"connector": "lucid.fileupload",
"type": "fileupload",
"pipeline": "api-test-app",
"properties": {
"fileId": "pokedex.json.zip",
"description": "My test datasource"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://{FUSION HOST}/api/connectors/datasources")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"test-data-source\",\n \"parserId\": \"api-test-app\",\n \"connector\": \"lucid.fileupload\",\n \"type\": \"fileupload\",\n \"pipeline\": \"api-test-app\",\n \"properties\": {\n \"fileId\": \"pokedex.json.zip\",\n \"description\": \"My test datasource\"\n }\n}")
.asString();const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'test-data-source',
parserId: 'api-test-app',
connector: 'lucid.fileupload',
type: 'fileupload',
pipeline: 'api-test-app',
properties: {fileId: 'pokedex.json.zip', description: 'My test datasource'}
})
};
fetch('https://{FUSION HOST}/api/connectors/datasources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION HOST}/api/connectors/datasources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"test-data-source\",\n \"parserId\": \"api-test-app\",\n \"connector\": \"lucid.fileupload\",\n \"type\": \"fileupload\",\n \"pipeline\": \"api-test-app\",\n \"properties\": {\n \"fileId\": \"pokedex.json.zip\",\n \"description\": \"My test datasource\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION HOST}/api/connectors/datasources"
payload := strings.NewReader("{\n \"id\": \"test-data-source\",\n \"parserId\": \"api-test-app\",\n \"connector\": \"lucid.fileupload\",\n \"type\": \"fileupload\",\n \"pipeline\": \"api-test-app\",\n \"properties\": {\n \"fileId\": \"pokedex.json.zip\",\n \"description\": \"My test datasource\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION HOST}/api/connectors/datasources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'test-data-source',
'parserId' => 'api-test-app',
'connector' => 'lucid.fileupload',
'type' => 'fileupload',
'pipeline' => 'api-test-app',
'properties' => [
'fileId' => 'pokedex.json.zip',
'description' => 'My test datasource'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://{FUSION HOST}/api/connectors/datasources \
--header 'Content-Type: application/json' \
--data '
{
"id": "test-data-source",
"parserId": "api-test-app",
"connector": "lucid.fileupload",
"type": "fileupload",
"pipeline": "api-test-app",
"properties": {
"fileId": "pokedex.json.zip",
"description": "My test datasource"
}
}
'{
"id": "test-data-source",
"created": "2024-08-02T21:00:42.165Z",
"modified": "2024-08-02T21:00:42.165Z",
"connector": "lucid.fileupload",
"type": "fileupload",
"pipeline": "api-test-app",
"parserId": "api-test-app",
"properties": {
"description": "My test datasource",
"fileId": "pokedex.json.zip",
"mediaType": "application/octet-stream"
}
}Query Parameters
Indicates if the configuration should be created (persisted) or just validated.
The context of resource. It usually is the app inside which the resource is created.
Body
application/json
The body is of type object.
Response
201 - application/json
Created
The response is of type object.
Was this page helpful?
⌘I