Now that the data sources have been imported, we are ready to create an endpoint and build a pipeline using one of these data sources. Xapix supports several types of endpoints. Here, we create a REST endpoint.
The recommended method is manually using an HTTP Method and a URL, but for our tutorial we will create an endpoint automatically.
Let's create an endpoint directly from a data source using a data source's options menu as shown below.
Using the data source findEngineByID, Xapix creates a one-to-one mapping from a data source to the following new endpoint:
Click Data Sources from the Home menu. This lists the available data sources to your project.
Locate the data source findEngineById in the list of data sources.
Click the down arrow at the end of a data source row to reveal the Options menu for the selected data source.
Click Create mapping with Data Source.
Xapix then creates a Request unit and an endpoint and maps the findEngineById data source to the endpoint as shown below.
Notice the endpoint shown above contains the path parameter
Xapix automatically added this path parameter to the Request unit. It also added a default value which it obtained from the schema, as shown in the example below.
In the pipeline, click the Request unit. This opens the Edit Request pane.
Notice the path parameter
parameters:- name: engine_idin: pathdescription: Car engine ID.required: truetype: integerexample: 547290
A key feature of the Pipeline dashboard is using drag and drop to map attributes in one unit to parameters in another unit. You simply drag an attribute from a unit over to a placeholder for a parameter in a second unit.
Because we used Create mapping with data source, Xapix mapped the Request attribute
engine_id to a path parameter in findEngineById, as shown below.
Similarly, the attributes in findEngineById are mapped to the endpoint parameters. As before, this mapping has already been done for you.
You should see a mapping between the findEnglineById attributes
price to body parameters in the endpoint, as shown below.
How did Xapix know to map these attributes to the endpoint? This is because these four attributes are specific to the path attribute engine_id set in the request.
When a request is made to the endpoint with a path parameter value set to
547290, the values of the attributes for engine_id are returned. Here they are in the data source Swagger file.
Engine:type: objectproperties:power_hp:type: stringexample: 180fuel_type:type: stringexample: "Diesel"manufacturer:type: stringexample: "Remedy Engines"price:type: stringexample: 4800
So, now that you have created an endpoint and created a mapping between units on the pipeline, your project is ready to be published.
Continue with Publish the project.