API Call
Overview
Sends an HTTP request and returns the response
To set this block up to make an API call, set the required values in the properties panel.
If you have an example in a cURL format of the API you are calling, you can paste it into the import box and Comnoco will map the values for you.
If you have an API that is documented in an OpenAPI or Swagger spec, Comnoco can import those and will create a function per endpoint for you in a new logix file. To do this select import from the dashboard.
Don't forget that you can make any value dynamic and programmed by exposing it to the tree via the checkbox.
This block is best placed on the From
slot of a Set Data Structure
.
When used like this you are able to capture and work with the response.
If you place it directly into a process slot you won't be able to see and use the response.
Handling Multi Part Forms
If you wish to send a content type of multipart/form-data
you can set each part in an array on the body.
You can also define whether or not a part should be sent as a file by adding the attribute filename
to the part/blocks attributes.
If you are sending a file part that is stored as base64 encoded in Comnoco, you can make it auto decode by adding the attribute c-base64
with a value of decode
to the part/blocks attributes. You can also do the opposite by setting it to encode
.
Returns |
---|
Data Structure |
Parameters
Parameter | Parameter | Valid Blocks | Required |
---|---|---|---|
Import from cURL command | Generate blocks for the HTTP(S) / API Request parameter slots using a cURL command. | Text Block Group | No |
HTTP Method | The HTTP method (GET, POST, PUT, etc.) | Text Block Group | No |
Auth Mechanism | How to authenticate the request | HTTP Request Auth Block Group | No |
URL | The URL to call | Text Block Group | No |
Query Parameters (Object) | A Data Structure containing an object where each key and value becomes a URL query parameter, eg ?hello=greeting | Data Structure Process Block Group | No |
Request Headers | Request header fields to be sent by the client | Data Structure Process Block Group | No |
Request Content-Type | For requests (such as POST or PUT), indicates what type of data is being sent in the request (e.g. application/json) | Text Block Group | No |
Request Cookies | Request cookies to be sent by the client | Data Structure Process Block Group | No |
Request Body | The request body | Marshalled Data Process Block Group | No |
Catch Errors to Data Structure | Catch errors from the Login call to Supabase as a Data Structure and return them as the response value to enable manual error handling. If turned on errors will not get caught in a Try-Catch block. | Boolean Block Group | No |