API Route
To create and manage an API route trigger.
An API Route can be invoked by HTTP requests. A data process linked to an API route is essentially a web service or a HTTP endpoint.
Create an API Route
- LOC Studio
- In LOC Studio, go to Trigger ➞ API Route.

- An API route belongs to a project, which can be created in the data process explorer. Create one if needed.

- Click Create API Route on the top right, or right-click a project and select the same option.

You won't be able to create new API routes if existing ones have reached the maximum limit specified in your license. (See: Inspect License.)
An ad hoc version of Studio 2.0.0 also shows the API usage (for example, ) on the upper right corner of the API route screen.
- Fill in the fields in the API route creation window.

API Route Fields Description
| Field | Required? | Description |
|---|---|---|
| API Route Name | Yes | API route name (up to 128 characters) |
| Description | No | API route description |
| HTTP Method | Yes | Allowed HTTP method in HTTP requests |
| URL | Yes | API route path (for example, /path or /api/path) |
| Request Mode | Yes | Synchronous (wait for task results) or asynchronous (do not wait for task results) |
| Response Content Type | Yes | Content type of the HTTP response |
| Encapsulation | Yes | Encapsulate execution metadata (default true) |
| API Tasks | Yes | Data processes to be linked |
You can create multiple API routes with the same path that accept different HTTP methods.
- Search data processes and click + API Task to link them.

- Fof the linked data processes, you can also quickly select the latest revision
or delete
them.

- Click Create to create the API route.
Normally, the body of a HTTP response returned from an API route will contain
- Metadata of the execution
- Metadata and task results combined from all tasks in the execution
If Encapsulation is set to false, the response will only contain task results. Since the task results are entirely defined by users, this is a way to create RESTful APIs in LOC.
Edit or Delete an API Route
- LOC Studio
Select an API route and click Edit API Route or Delete API Route
on the top right, or right-click and select the same options.

Invoke an API Route
To execute a data process without an actual API route, see Manual Execution.
The URL of a created API route, for example, https://api.xxxxxx.fst.network/api/path is the HTTP endpoint that can accept specific methods from any HTTP clients:
curl -X GET 'https://api.xxxxxx.fst.network/api/path'
curl -X POST -d '{
"key": "value"
}' 'https://api.xxxxxx.fst.network/api/path'
API Route HTTP Status Code
An API route may return one of the following HTTP status code:
| HTTP Status Code | Description |
|---|---|
200 | The execution has completed with or without errors. |
202 | The execution time has exceeds 15 seconds in synchronous mode (timed out). The execution may still complete later. |
404 | The API route is not found. If you have just created the API route, wait a moment then try again |
405 | The API route exists but you are using incorrect HTTP request methods. |
User can also use result agent to set a different HTTP status code when the execution completes.