Thanks,The FileQuery API code sample that you provided above is of no use for me as there is no information of the Databases ID.
There is not database ID, only a data connector ID. The data connector needs to be created by you, and then you want to override it on a per tenant basis. The override that you are trying to create can then override the properties of that data connector (eg. Initial Catalog property).
Can you please let me know how much time that ticket will take?
If time is critical I suggest emailing support@dundas.com, they will provide a ticket number and have dedicated resources so they can directly assist in getting this done as fast as possible. They can also set up a go to meeting if the situation requires it.
With that, It will be possible for me to access the Initial Catalogue ID/ Database ID/ Parameter ID by Data base name ??
I think you need to do is
-
create one dataconnector which connects to a database (this would be one of the “there are more than 100 Databases”) .
-
Then override that data connector when creating a tenant. You would use the data connector ID you would override the initial catalog by using the property on the SQL server dataconnector which is defined as “8FFE4086-6013-4586-902C-FDA2502548D4” as defined in the table above. You would use the dataconnector ID. You would never use a database ID.
Note the schema needs to be the same when using dataconnector overrides.
I’ve puts some comments on the example below:
void Main()
{
string baseUrl = "http://localhost:8001";
using (HttpClient httpClient = new HttpClient())
{
// Get Session Id
string logonUri = baseUrl + "/Api/LogOn/";
var logonOptions = new
{
accountName = "admin",
password = "1234",
cultureName = string.Empty,
deleteOtherSessions = true,
isWindowsLogOn = false
};
JavaScriptSerializer serializer = new JavaScriptSerializer();
var requestBodyAsString = serializer.Serialize(logonOptions);
StringContent content =
new StringContent(
requestBodyAsString,
Encoding.UTF8,
"application/json"
);
string jsonString = string.Empty;
using (var response = httpClient.PostAsync(logonUri, content).Result)
{
jsonString =
response.Content.ReadAsStringAsync().Result;
}
TenantData tenantData = new TenantData();
tenantData.AccountNamePattern = "T";
tenantData.Name = "MyTenant";
// The data connector you created, This should be the same for the 100's of databases.
// You will need to get this ID when you create the data connector.
Guid dataConnectorId = new Guid("a102fefc-62c9-4517-9bf4-77c9a08c4f76");
// The initial catalog property ID, this will not need to change.
Guid initialCatalogId = new Guid("8FFE4086-6013-4586-902C-FDA2502548D4");
string initialCatalog = "Corgent Data New";
// The value for the inital catalog that will be set in the override data.
ParameterValueData initialCatalogParameterValueData = new ParameterValueData();
initialCatalogParameterValueData.ParameterValueType = ParameterValueTypes.SingleString;
initialCatalogParameterValueData.Value = initialCatalog;
initialCatalogParameterValueData.ParameterId = initialCatalogId;
// Create the override data.
ProviderPropertyOverrideData providerPropertyOverrideData = new ProviderPropertyOverrideData();
providerPropertyOverrideData.Key = dataConnectorId;
providerPropertyOverrideData.Value.Add(initialCatalogParameterValueData);
// Add the override
tenantData.DataConnectorPropertyOverrides.Add(providerPropertyOverrideData);
tenantData.LicenseSeatAllocation = new TenantSeatAllocationData();
var obj = (Dictionary<string, object>)serializer.DeserializeObject(jsonString);
string sessionId = obj["sessionId"].ToString();
string url = baseUrl + "/API/Tenant/?sessionId=" + sessionId + "";
// Define the request body
HttpContent requestBody = null;
requestBody =
new StringContent(
JsonConvert.SerializeObject(tenantData),
Encoding.UTF8,
"application/json");
using (var response = httpClient.PostAsync(url, requestBody).Result)
{
if (response.StatusCode == HttpStatusCode.OK)
{
Console.WriteLine("Success");
string jsonObject = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(jsonObject);
}
}
}
}