Map parameters to endpoint

The final step is to map attributes from the data source units to parameters in the endpoint. To do this, we use some of the features of the Mapping editor including mapping all attributes to a unit in one click and creating nests (folders) as child elements.

Mapping between findVariantById and Endpoint

We first use automatic mapping in the Mapping editor to map all attributes in findVariantById to body parameters in the Endpoint. This provides to the response all values for the variant QLM_KROSUS_4_DOOR_LIMO.

First, click on the Endpoint unit to open the Mapping editor. The body object should be expanded showing all input attributes.

On the left column next to findVariantById click the three dots ... to open the Options menu. Then select Map all attributes to unit.

All attributes in findVariantById are automatically mapped to the body object in the Endpoint.

First endpoint mapping

Creating engine and model properties

We now want to create two new properties in the Endpoint body object - engine and model. We use the New property feature which allows us to add under the body object another object, array, string, number or boolean property. In this case both engine and model will be object.

Let's make the engine property. In the body object click in New Property to make it editable. Enter engine and from the options on the right select {} Object. Then click Create. The new property is added to the end of the list of elements. Scroll down to find it.

Create new properties

Now, let's make the model property using the same procedure. Click New Property in the body object and enter model. Select {} Object, then click Create. This new property is added to the end of the list of object elements.

Currently, these new properties do not have a value. We need to map attributes from findEngineById and findModelById to these properties to provide to them values.

New properties added

Mapping findEnglineById to Endpoint

Under findEnglineById we have four attributes, price, power_hp, fuel_type and manufacturer. We want to map these attributes under our new object engine.

In the left column scroll down to locate the findEngineById attributes. In the Endpoint column locate the engine property we just created and expand it to show the object.

Using the same drag and drop feature we used to make connections to units, drag these four attributes to the engine object we just created. Drop the attribute over the New Property field in the object.

When dragging an attribute to map it to an object, the target location (New Property) to drop the attribute will be highlighted. Drag the attribute over this highlighted area and drop it there to create the mapping.

Mapping findEngineById to Endpoint

Mapping findModelById to Endpoint

Under findModelById, we have three attributes brand, model and description. We want to map these attributes under our new object model.

Using the same procedure we used for findEnglineById, drag all three attributes to the model object in the Endpoint object. Remember to expand model to reveal the New Property field as this is where we drop the attributes into this object.

Mapping findEngineById to Endpoint

The Endpoint is now mapped to the attributes of the three data sources using an automatic and manual features of the Mapping editor to add properties to the body object of the Endpoint.

Click Done to save your changes and close the Mapping editor.

Next step
Next step

To continue, see Preview the endpoint.