- Print
- DarkLight
- PDF
API Gateway Data Model and General Interaction Diagram
API Gateway data model
There are two entities in the API Gateway data model:
- API (endpoint);
- Path (resource).
A single API entity is a collection of paths. When creating an API (Simulator workspace menu->Corezoid) a new Project in Corezoid is created with default Production and Develop Stages.
Each of the created APIs (Stages) gets an ID. An API ID is a unique string which identifies that the API in URLs is a part of FQDN (Fully Qualified Domain Name). For example, in the https://foo.example.com/bar/baz
URL, the foo
string is the API ID.
To add new APIs to the default Production and Develop ones, or remove APIs, you need to open the created Corezoid Project and manually create or remove the unneeded Stages in it. After that, click Refresh in the Projects -> Stages menu in Simulator to see the changes.
Path entities (which you can create in Simulator workspace menu->Corezoid->To all APIs->Projects->Stages by clicking the Create path button) store information on target Corezoid processes and call parameters. Any API path is represented by a URL path. In the https://foo.example.com/bar/baz
URL, the /bar/baz
string is the path.
Every path-method pair must be unique within its API
This design enables using, for example, different request methods when sending tasks to the same process.
Due to the flexible router's implementation, you can use variables and regular expressions in API Gateway paths. For example, you can use the following constructions in the Path part:
- /hubs/{hubID}/view
- /hubs/{hubID}/view/*
- /articles/files/{file}.{ext}
- /articles/{rid:^[0-9]{5,6}}
- /articles/{id:^[1-9]+}-{aux}
For more examples, follow the link.
API Gateway entry points
API Gateway has two entry ponts (protocols):
- Proxy: https://*.apigw.corezoid.com
This entry point must be configured in Simulator via CDU scripts, and all the paths must already be created. You can select synchronous or asynchronous mode. - SyncAPI: https://sync-apigw.corezoid.com
It is analogous to Corezoid Sync API.
An API GW endpoint created in Asynchronous mode functions similarly to a Corezoid endpoint: sending a request always results in an OK response, but sending a signature is not mandatory.
API Gateway interaction diagram
API Gateway interaction general workflow
The general workflow for API Gateway use can be described as follows:
- A user creates a Corezoid Project with default Develop and Production Stages, which are API entities (endpoints) with their own IDs, and path entities (resources) attached to each API. The user then provides an API administrator with the required information, including the target process ID and call parameters.
- The API administrator obtains a URL for calling the created path.
- A client sends a task to the provided URL.
- API Gateway receives the task in a JSON file and proxies it to Corezoid.
- If the called path is Synchronous, API Gateway waits for the task processing result from Corezoid.
If the called path is Asynchronous, API Gateway responds to the client with the 204 status as soon as the task is accepted by Corezoid.