title: "REST API"
lang: "en-US"
draft: false
description: "Learn about how to set up a VDP REST API component https://github.com/instill-ai/instill-core"
The REST API component is a generic component that allows users to make requests to external REST APIs.
It can carry out the following tasks:
Release Stage
Alpha
Configuration
The component definition and tasks are defined in the definition.json and tasks.json files respectively.
Setup
In order to communicate with the
external application, the following connection details need to be
provided. You may specify them directly in a pipeline recipe as key-value pairs
within the component's setup
block, or you can create a Connection from
the Integration Settings
page and reference the whole setup
as setup: ${connection.<my-connection-id>}
.
Field | Field ID | Type | Note |
---|
Authentication (required) | authentication | object | Authentication method to use for the REST API |
The authentication
Object
Authentication
authentication
must fulfill one of the following schemas:
No Auth
Field | Field ID | Type | Note |
---|
Auth Type | auth-type | string | Must be "NO_AUTH" |
Basic Auth
Field | Field ID | Type | Note |
---|
Auth Type | auth-type | string | Must be "BASIC_AUTH" |
Password | password | string | Password for Basic auth |
Username | username | string | Username for Basic Auth |
API Key
Field | Field ID | Type | Note |
---|
Auth Location | auth-location | string | Add the API key to the header or query params.
Enum values |
Auth Type | auth-type | string | Must be "API_KEY" |
Key Name | key | string | Key name for API key authentication |
Key Value | value | string | Key value for API key authentication |
Bearer Token
Field | Field ID | Type | Note |
---|
Auth Type | auth-type | string | Must be "BEARER_TOKEN" |
Token | token | string | Bearer token |
Supported Tasks
Get
Send a HTTP GET request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_GET |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | output-body-schema | string | The request body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |
Post
Send a HTTP POST request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_POST |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | body | any | The request body |
Body | output-body-schema | string | The JSON schema of output body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |
Patch
Send a HTTP PATCH request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_PATCH |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | body | any | The request body |
Body | output-body-schema | string | The JSON schema of output body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |
Put
Send a HTTP PUT request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_PUT |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | body | any | The request body |
Body | output-body-schema | string | The JSON schema of output body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |
Delete
Send a HTTP DELETE request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_DELETE |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | body | any | The request body |
Body | output-body-schema | string | The JSON schema of output body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |
Head
Send a HTTP HEAD request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_HEAD |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | output-body-schema | string | The request body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |
Options
Send a HTTP OPTIONS request.
Input | ID | Type | Description |
---|
Task ID (required) | task | string | TASK_OPTIONS |
Endpoint Url (required) | endpoint-url | string | The API endpoint url |
Body | body | any | The request body |
Body | output-body-schema | string | The JSON schema of output body |
Output | ID | Type | Description |
---|
Status Code | status-code | integer | The HTTP status code of the response |
Body | body | any | The body of the response |
Header | header | object | The HTTP header of the response |