Skip to main content

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.

tip

Don't forget that you can make any value dynamic and programmed by exposing it to the tree via the checkbox.

tip

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. Multipart Form Data

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

ParameterParameterValid BlocksRequired
Import from cURL commandGenerate blocks for the HTTP(S) / API Request parameter slots using a cURL command.Text Block GroupNo
HTTP MethodThe HTTP method (GET, POST, PUT, etc.)Text Block GroupNo
Auth MechanismHow to authenticate the requestHTTP Request Auth Block GroupNo
URLThe URL to callText Block GroupNo
Query Parameters (Object)A Data Structure containing an object where each key and value becomes a URL query parameter, eg ?hello=greetingData Structure Process Block GroupNo
Request HeadersRequest header fields to be sent by the clientData Structure Process Block GroupNo
Request Content-TypeFor requests (such as POST or PUT), indicates what type of data is being sent in the request (e.g. application/json)Text Block GroupNo
Request CookiesRequest cookies to be sent by the clientData Structure Process Block GroupNo
Request BodyThe request bodyMarshalled Data Process Block GroupNo
Catch Errors to Data StructureCatch 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 GroupNo