Chapter 2: Call an API with a connector
Chapter 2 of the Orchesty onboarding series: import the demo-get-product topology, install and activate your first application, and run a connector that fetches a single product, including what a failed message looks like.
In Chapter 1 you drew a topology by hand to learn the editor. From now on you'll simply import the ready-made topologies that ship with the demo worker and run them. The goal is to meet each new building block, not to redraw canvases. These are deliberately tiny examples; the video shows every click, so you don't have to build anything.
This chapter introduces the connector: a node that makes a single API call.
By the end you'll be able to:
- Import a topology from the demo worker and run it.
- Install, authorize, and activate an application, and understand why connectors need one.
- Run a connector and inspect a failed message.
Prerequisites #
You finished Chapter 1: the demo worker is running and connected to your platform.
What's new in this chapter #
Mock server. The demo worker ships a small mock server so you can call a realistic API without a real backend. Start it in a separate terminal from the worker folder:
npm run mock-server
It listens on http://localhost:3210. The full endpoint list lives in the demo worker's README.
Application. A connector never connects on its own; it delegates the base URL and auth to an application. Install Products Test (Simulation) in the Admin UI, open its Authorization tab, set Base URL to http://localhost:3210 (the default, pointing at the mock), and Save, so it becomes Authorized. Then click Activate. A connector only runs against an application that is both authorized and active.
The application details also have a Limiter tab (Use limit + rate) to cap how fast the platform calls the app, a no-code way to respect an API's rate limits. Leave it off here. For the settings mechanism in general, see Authentication & settings.
Connector. The new node type. It makes one API call and shapes the response for the next node. Here products-test-get-product takes { id } and returns a single product. Background: Connectors & applications.
Import and run #
Topologies ship as files in the demo worker's src/topologies/ folder, so you don't draw them; you import them. In the Topologies section, import demo-get-product.tplg.json (the video shows the exact import dialog), then Publish and Enable it.
Now run it from its trigger, first the failure, then the fix:
- Run with an empty payload (
{}). The connector needs anid, so the process fails and the node gets a red !. Click it to open the Failed Message panel:result status [400], message: Error occurred: Missing required param [id] - Run again with real data:
{ "id": 1 }
The connector calls the mock server and returns the product ({ id, sku, name, price }), visible in the Processes tab and in the mock server's terminal log.
You can drop a breakpoint anywhere in a topology to pause and watch the data at that point. It's handy whenever you want to see exactly what a node produced.
Where next #
In Chapter 3 you'll import the demo-products-test-bulk-sync topology and meet the batch node, which pages through the whole catalog instead of fetching one product.
Want to read the code behind this chapter? Browse the demo worker on GitHub: Orchesty/orchesty-demo-worker. The connector lives in src/ProductsTest/Connector/, the application in src/ProductsTest/.