Create and map the REST schema
- Last Updated: July 2, 2019
- 3 minute read
- Corticon
- Documentation
To use a REST data source, Corticon needs to know how to map the JSON from the REST service to relational tables. The easiest way to do this is to discover the schema. The Autonomous REST Connector used by Corticon has the ability to query a REST service and infer a relational schema from the JSON returned.
- In Corticon Studio on
the Vocabulary's Datasource tab, click SCHEMA: Discover.
Corticon will query the REST service using the REST URL and query parameters
defined on the data source. The JSON returned will be used to generate a schema
for mapping JSON from the REST service to a relational representation. The
metadata for this schema is added to the Vocabulary for the Entities (tables),
Attributes (columns), and Associations (join expressions). If the imported
tables and columns do not align with entities and their attributes, those values
will require manual mapping.
The schema for how to map the JSON from a REST service to a relational model is stored in the vocabulary. You can export this schema to a text file using Export then import it back to your vocabulary using Import after any modifications.
Note: When using discovery to generate the schema, the JSON returned needs to be representative of the data which would be returned at runtime. Any data elements not represented, will not be in the generated schema and therefore not available for mapping to your vocabulary. - The sample has two entities
ReimbursementRatesandRate, as illustrated:
Each of these entities has already been mapped to the REST Datasource. Clicking on either entity will show the Table Name of the table the entity to which it is mapped.
- Specify the Primary Key (PK) in the table as the Entity
Identity by clicking the Entity Identity Property Value
to open its menu, and then choose from the listed attributes. Here there is only
one attribute,
procedureCode:
- The sample's Rate entity is a JSON collection. The added
attributes are added to uniquely identity the data's position inside the
collection. Because there is no enforced uniqueness in the REST Datasource, two
transient attributes are added to handle possible duplicates:
- You specify its Primary Key (PK) in the database table as the
Entity Identity by clicking the Entity Identity Property
Value to open its menu, and then choosing both
positionandprocedureCodefrom the listed attributes. Thepositionattribute was created by the Autonomous REST Connector as a synthetic value that will ensure uniqueness of the primary key. - REST Data could have multiple rates that are an array of
objects that Corticon will manage as a one-to-many association with the
ReimbursementRates procedureCode
which is easier to see in the Join Expression dialog:
For more about REST data mapping, see Mapping REST Service metadata.