Jedox OData Hub Connector in C# and Other Programming Languages

To connect to Jedox OData Hub, you need to setup an OData client. You can find a list of client libraries here.

This article features examples using C# and the client library Simple.OData.Client, but this will work similarly with most languages and client libraries.

Connecting to the service

To connect to a cloud instance, use the following URL:

https://odata.{instanceId}.cloud.jedox.com/

Do not forget to replace the placeholder and the curly brackets to match the URL of your instance. The OData Service uses Basic Authentication. To sign in, provide your Jedox credentials.

Copy
var client = new ODataClient(new ODataClientSettings(
    new Uri("https://odata.{instanceId}.cloud.jedox.com/"), 
    new NetworkCredential("{username}", "{password}")
));

 

Fetching databases

To fetch the databases, you need to use the /Databases endpoint of the service. The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Databases
Copy
var databases = await client
    .For("Databases")
    .FindEntriesAsync();

foreach (var database in databases)
{
    Console.WriteLine(database["name"]);
}

For more information about the database request and its response, see OData API documentation.

Navigation: fetching databases

The databases are the only endpoint available from the root of the service. Each database contains a list of cubes, dimensions, and stored views. To fetch these contained entries, you need to navigate to the desired endpoint.

Copy
// Get Cubes of the Demo Database (Id: 1)
var cubes = await client
    .For("Databases")
    .Key(1)
    .NavigateTo("Cubes")
    .FindEntriesAsync();

foreach (var cube in cubes)
{
    Console.WriteLine(cube["name"]);
}

The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Databases(1)/Cubes

You can do the same to get the cells of a cube or stored view:

Copy
// Get the Cells of the Sales Cube (Id: 13) in the Demo Database (Id: 1)
var cells = await client
    .For("Databases")
    .Key(1)
    .NavigateTo("Cubes")
    .Key(13)
    .NavigateTo("Cells")
    .FindEntriesAsync();

foreach (var cell in cells)
{
    var path = string.Join(" - ", 
        cell.ToList()
            .Skip(3)
            .Select(x => $"{x.Key}: {x.Value}"));

    Console.WriteLine($"{cell["value"] ?? cell["stringValue"]} - {path}");
}

The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Databases(1)/Cubes(13)/Cells

If the ID is a GUID, such as for a stored view, you can do the following:

Copy
var cells = await client
    .For("Databases")
    .Key(1)
    .NavigateTo("Views")
    .Key(new Guid("a308554a-0e11-4a62-86c4-ae9366892f4e"))
    .NavigateTo("Cells")
    .FindEntriesAsync();

See OData API documentation for an overview of the available endpoints.

Fetching Integrator projects

To fetch the databases, you need to use the /Databases endpoint of the service. The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Integrator('globalprojects')/Projects
Copy
            var projects = await client
                .For("Integrator")
                .Key("globalprojects")
                .NavigateTo("Projects")
                .FindEntriesAsync();
 
            foreach (var project in projects)
            {
                Console.WriteLine(project["Name"]);
            }

For more information about the database request and its response, see the OData API documentation.

Fetching Integrator rows

To fetch Integrator data, you need to navigate to the desired endpoint.

Copy
var extracts = await client
                .For("Integrator")
                .Key("globalprojects")
                .NavigateTo("Projects")
                .Key("sampleBiker")
                .NavigateTo("Extracts")
                .FindEntriesAsync();
 
            foreach (var extract in extracts)
            {
                Console.WriteLine(extract["Name"]);
            }

The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Integrator('globalprojects')/Projects('sampleBiker')/Extracts

You can do the same to get the cells of a cube or stored view:

Copy
            var rows = await client
                .For("Integrator")
                .Key("globalprojects")
                .NavigateTo("Projects")
                .Key("sampleBiker")
                .NavigateTo("Extracts")
                .Key("Products")
                .NavigateTo("Rows")
                .FindEntriesAsync();
 
            foreach (var row in rows)
            {
                var columns = string.Join(" - ",
                    row.ToList()
                        .Select(x => $"{x.Key}: {x.Value}"));
 
                Console.WriteLine(columns);
            }

The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Integrator('globalprojects')/Projects('sampleBiker')/Extracts('Products')/Rows

Running Integrator loads and jobs

Below you see how to run loads and jobs:

Copy
            var runResult = await client
                .For("Integrator")
                .Key("globalprojects")
                .NavigateTo("Projects")
                .Key("ETLTasks")
                .NavigateTo("Jobs")
                .Key("CubeCopy")
                .Function("Run")
                .Set(new { variables = "SourceConn=\"localhost\",TargetConn=\"localhost\"" })
                .ExecuteAsSingleAsync();
 
            foreach (var kvp in runResult)
                Console.WriteLine($"{kvp.Key}: {kvp.Value}");

The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Integrator('globalprojects')/Projects('ETLTasks')/Jobs('CubeCopy')/Default.Run(variables='SourceConn="localhost",TargetConn="localhost"')

Filtering

Most client libraries have a built-in way to filter the response data. Those filters will be forwarded to the server so that less traffic is generated. For more information on the OData filter, see OData's documentation.

Copy
var databases = await client
    .For("Databases")
    // Only get the first 5 databases
    .Top(5)
    .FindEntriesAsync();

Custom query options

In the OData API documentation you can find a list of available custom query options.

Copy
var cells = await client
    .For("Databases")
    .Key(1)
    .NavigateTo("Cubes")
    .Key(13)
    .NavigateTo("Cells")
    // Set the userules and baseonly flag
    .QueryOptions(new Dictionary<string, object>() { { "userules", false }, { "baseonly", false } })
    .FindEntriesAsync();

The client will then internally generate the following URL:

https://odata.{instanceId}.cloud.jedox.com/Databases(1)/Cubes(13)/Cells?userules=false&baseonly=false

If the client has no function to set the custom query options, you need to use the full URL instead.

Updated December 9, 2024