Phase 1 — Consume an API
Time to complete: ~10 minutes
Overview: In this phase, you’ll create a simple workflow that calls an external API to fetch data. You’ll use Lonti’s Demo Ecommerce API, published at Lonti's web site apiexplorer.io, that hosts a collection of demo APIs for purposes of experimentation and learning. The result will be a workflow that returns live data from the public API.
A view of the completed Phase 1 workflow.
Steps
-
In this step, you will obtain an Access Token that will enable you to consume all of the demo APIs from Lonti's website apiexplorer.io. To obtain an Access Token:
- Log in to the Lonti Console
- In the Dashboard of Lonti Console, under the title
apiexplorer.io
, click on the linkGet Demo APIs Access Token
- Copy the value to your clipboard. You will be using it in Step 3 below.
Note: The Access Token expires after 24 hours. You will need to obtain a new Access Token by following this same procedure after 24 hours.
-
In this step, you will create a Package in Martini Designer. A Package is the basic unit of organization in Martini; it groups related services, workflows, APIs, and resources together so they can be managed and deployed as a single portable artifact. To create a Package in Martini Designer:
- Click the + button in the main toolbar and select Package.
- Enter the Name
my-first-project
for the Package and click Create.
-
In this step, you will use Martini Designer's built-in HTTP Client to consume the Get SKUs operation of the Demo Ecommerce API. This allows you to test the API call and view its response. Later, in Step 4, you'll use the same HTTP request to export a reusable service. To consume the API in Martini's HTTP Client:
- Open the HTTP Client by clicking the HTTP icon in the left-hand navigation bar.
- Start a new request by clicking the + button in the HTTP Client toolbar.
- Enter the following values in the HTTP request editor:
- Method: GET
- URL:
https://demo-api.apiexplorer.io/api/lonti_demo_api_ecommerce/1.0/sku
- Under the Authentication tab enter the following values:
- Authentication: OAuth 2.0
- Access Token:
<paste the token from Step 1>
- Click Send to execute the request.
-
Expected output:
- Status:
200
- Body:
<a JSON array of SKUs>
The object below is a representative element of the list/array of SKUs returned:
1 2 3 4 5 6 7 8 9 10 11
{ "skuId": 1, "name": "Chisel Wood 6mm", "productCode": "SKU001", "productVariant1": "Wood", "productVariant2": "6mm", "price": 13, "createdDate": "2025-08-12T02:30:21+0000", "modifiedDate": "2025-08-12T02:30:21+0000", "itemId": 1 }
- Status:
-
In this step, you will save the HTTP Client request from Step 3 as a reusable service. Services can be included as a step within a workflow or can be configured as a handler for an API operation. To save the HTTP Client request and export it as a service:
- With the HTTP Client request tab still active, click Save in the main toolbar.
- Enter any name for the request (or accept the default) and click Save.
- The saved request will appear under the User Requests in the HTTP Client panel. Right-click it and select Export → Service.
- Use the Browse button to select the Package
my-first-project
that you created in Step 2. - Name the service
GetAllEcommerceSku
, click Next, accept the defaults, then click Finish.
-
In this step, you will create a workflow to orchestrate the call to the external API. A Martini workflow is an automated sequence of triggered steps—built with nodes for logic, data, and integrations—that orchestrates APIs, processes, and systems. To create a workflow:
- Click the + button in the main toolbar and select Workflow.
- Browse to the Package
my-first-project
, then name the workflowMyFirstWorkflow
and click Create. - Using the Navigator menu (if the menu is not visible, click the Navigator icon in the left-hand navigation bar), expand the package
my-first-project
and theLogic
folder thereunder. - Drag the
GetAllEcommerceSku
service onto the workflow editor indicated by the tab labeledMyFirstWorkflow
. - Connect the two nodes in your workflow by dragging the arrow from the node labelled
Start Trigger
to the node labelledInvoke GetAllEcommerceSku
. - Click the expand icon on the node labelled
Invoke GetAllEcommerceSku
. This will open the node's input/output mapper. In the Output expand theGetAllEcommerceSkuOutput
model, then right-clicksku
and select the menu option Add Property and Map. Name the modelskuArray
then click the button Add Property and Map.
-
At this point, you can run your workflow to verify its output. To run your workflow:
- Click the Run button in the workflow editor toolbar. Accept the defaults and click Run.
- Expected output in the Console:
- Logs tab:
<Output available, click the Output tab to view it>
- Output tab: Expand the tree
skuArray
→[0]
…[n]
- Logs tab:
-
In this step, you will add a configuration property for your access token so that it can be reused across multiple services and workflows. In this step the value of the access token will be stored in the Package properties and reference to its location will be added to the service. To add a configuration property for your access token:
- Open the Package properties by right-clicking the Package
my-first-project
and selecting Edit properties. - Enter
access.token=<value>
where<value>
is the access token from Step 1. - Click Save in the main toolbar to save the changes to your Package properties.
- Return to the workflow editor for the workflow
MyFirstWorkflow
and click the expand icon on the node labelledInvoke GetAllEcommerceSku
. This will open the node's input/output mapper. - Expand the tree next to the model
authorisation
under the Input panel, then double-click on the property labelledaccessToken
. Set the language toGroovy
, enter the following expression, then click Apply:1
'access.token'.getPackageProperty()
- Open the Package properties by right-clicking the Package
-
Verify that the change was successful by rerunning your workflow following the same procedure in Step 6.
What’s next: In Phase 2, you’ll learn how to add a step to your workflow that enriches your data.