Create an endpoint

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.

Creating an endpoint manually

The recommended method is manually using an HTTP Method and a URL, but for our tutorial we will create an endpoint automatically.

Creating an endpoint manually

For information about manually creating an endpoint, see REST endpoints.

Creating an endpoint using a data source

Let's create an endpoint directly from a data source using a data source's options menu as shown below.

Create an endpoint using menu option

Using the data source findEngineByID, Xapix creates a one-to-one mapping from a data source to the following new endpoint:

/xapix-io-api-data/vehicle-demo/engines/{engine_id}.json

Step

Description

1

Click Data Sources from the Home menu. This lists the available data sources to your project.

2

Locate the data source findEngineById in the list of data sources.

3

Click the down arrow at the end of a data source row to reveal the Options menu for the selected data source.

4

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.

Endpoint and pipeline created

Request unit - path parameter value

Notice the endpoint shown above contains the path parameter {engine_id}.

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.

Default value for parameter in Request unit

In the screenshot above, the pipeline has been hidden. Look for a small icon above and to the right of the Request unit pane. Clicking it collapses the pipeline.

Step

Description

1

In the pipeline, click the Request unit. This opens the Edit Request pane.

2

Notice the path parameter {engine_id} has been set with a value, in this case 547290. The data source provided this example value which was automatically loaded into the Request unit.

parameters:
- name: engine_id
in: path
description: Car engine ID.
required: true
type: integer
example: 547290

Mapping between Request and findEngineById

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.

Mapping between Request and findEngineById

Notice the attribute engine_id in the Request unit is uneditable. Only parameters can be edited. This is explained in Attributes and parameters in Mapping dashboard.

Mapping between findEngineById and endpoint

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 fuel_type, manufacturer, power_hp and price to body parameters in the endpoint, as shown below.

Mapping between findEngineById and Endpoint

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: object
properties:
power_hp:
type: string
example: 180
fuel_type:
type: string
example: "Diesel"
manufacturer:
type: string
example: "Remedy Engines"
price:
type: string
example: 4800

Remember to click Done to save your changes.

So, now that you have created an endpoint and created a mapping between units on the pipeline, your project is ready to be published.

Next step
Next step

Continue with Publish the project.