Getting Table Data (All Rows)

<< Click to Display Table of Contents >>

RayVentory Data Hub > 12.5 u5 > Administration and User Guide > Advanced Topics > Data API 

Getting Table Data (All Rows)

This is the simplest way of querying the data.

 

Type of Request

GET

 

Endpoint URL

http://[host]:[port]/v1/resultDatabase/table/<table-name>

 

Query Parameters

Parameter

Required

Description

includeDataTypes

No (default: false)

If set to true, then the CSV will receive an extra row after headers but before the data, which describe the actual column types (as indicated by the database engine).

 

If you omit this parameter or set it to false, the returned CSV will not have this extra information, but will be then cross-compatible with other CSV-capable software.

 

Headers

Parameter

Required

Description

ApiKey

Yes

Your API key (see chapter Authentication and authorization for more information how to get it).

 

Sample (PowerShell)

The following code connects to the instance https://datahahub.local (using SSL and port 443) with authentication token M6KNS9Z-3404R00-Q42E4SG-1G4HKWT and then reads the content of the table Catalog_Software, which then gets written to local file c:\temp\results.csv.

 

$dataHubApiKey = "M6KNS9Z-3404R00-Q42E4SG-1G4HKWT";

$dataHubHostName = "https://datahub.local";

$dataHubPort = 443;

$tableName = "CatalogSoftware";

$outFile = "C:\temp\results.csv";

 

$urlAddress = "{0}:{1}/v1/resultDatabase/table/{2}" -f $dataHubHostName,$dataHubPort,$tableName

 

$headers = @{};

$headers["ApiKey"] = $dataHubApiKey;

 

$request = Invoke-WebRequest -Uri $urlAddress -Headers $headers -Method Get;

 

if ($request.StatusCode -eq 200)

{

    Write-Host $request.Content;

    $request.Content | Out-File $outFile

}

else

{

    throw "Could not list the tables. HTTP code {0}" -f $request.StatusCode;

}