This article will help you get started with building a data connector on top of the Curiosity API.

To get started, you will need four things:

To get started, open the Data Sources Hub on your Curiosity instance:

Then select the External Connectors option on the list of available data connectors:

To create an API token, click on the Create API Token button:

Give the token a name:

And save the created API token:

Note: Remember this token gives access to all data on your system with the same access as a system administrator. Keep it secure!

For the Connector Template Project, click on the Download Template Project button:

Curiosity will automatically generate a data connector project for you. Save and extract the resulting ZIP file, and you're ready to start writing your data connector.

You can open the connector project file on your IDE of choice. The project will contain two auto-generated files: App.cs and Schema.cs. The first contains a suggestion of code to connect to your instance and interact with it, and the second the list of all edges and data types on your system. If you update or add new data schemas, you can always download the template again and use the new Schema.cs file to update your existing connector.

Your empty App.cs file should look like the following:

public static class App
{
public static async Task Main(string[] args)
{
if(args is null || args.Length != 1)
{
PrintHelp();
return;
}

var token = args[0];

using (var graph = Graph.Connect("http://localhost:8080/", token, "Curiosity Connector"))
{
await UploadDataAsync(graph);
}
}

private static void PrintHelp()
{
Console.WriteLine("Missing API token, pass it as the first argument on the command line.");
}

private static async Task UploadDataAsync(Graph graph)
{
//Implement your data connection logic here!
}
}

With this setup, you should pass the API token you generated as an argument on the command line. To do so from Visual Studio, you should add it to your Project properties:

Add the API token in the Application arguments field:

Did this answer your question?