Configuring Queries In The Integration Framework

The Integration Framework contains sample code illustrating how to configure a query for a data entity called Items. To retrieve data via the API of the application you are accessing, you must configure query parameters for each data entity you want returned to TIBCO Scribe®.

Below is the sample code to query the Item entity. This line of code does the following:

  • Creates a query that is translated into a GET to the baseUrl + "/Items/"
  • Deserializes the Root
  • Yields the root.Items as Items

protected override IList<HttpQueryRegistration> ConfigureQueries()

{

var item = this.Queries.EnumerateResponseAs<Item, Root>("/Items", root => root.Items);

return new List<HttpQueryRegistration> { item };

}

Follow the model of the existing query to configure additional queries as needed. For example, if your datastore contains entities called Accounts and Contacts, and those entities are supported by the API, modify the sample to include Accounts and Contacts.

protected override IList<HttpQueryRegistration> ConfigureQueries()

{

var item = this.Queries.EnumerateResponseAs<Item, Root>("/Items", root => root.Items);

var account = this.Queries.EnumerateResponseAs<Account, Root>("/Accounts", root => root.Accounts);

var contact = this.Queries.EnumerateResponseAs<Contact, Root>("/Contacts", root => root.Contacts);

return new List<HttpQueryRegistration> { item, account, contact};

}

The sample code below illustrates the settings for a query that returns an array.

protected override IList<HttpQueryRegistration> ConfigureQueries()

{

var organization = this.Queries.EnumerateResponseAs<Organization, Organization[]>("/v1/orgs", r => r);

 

return new List<HttpQueryRegistration> { organization };

}

See Also

Fast Connector Framework (FCF)