Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions http-caller-get/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export function getDescription() {
return {
description: "HTTP Caller GET",
input: [
{
id: "get",
displayName: "URL GET",
description: "URL to call - method GET",
type: "Connector",
},
],
output: [],
} as const satisfies ScriptDescription;
}

export async function execute(context): Promise<Output> {
const requestEndpoint = context.parameters.get;
const response = await fetch(requestEndpoint);
console.debug(response.json());
}
8 changes: 8 additions & 0 deletions http-caller-get/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "http-caller-get",
"displayName": "HTTP Caller - GET request",
"description": "Provides an example of a GET request. Requires a Web endpoint type connector. WARNING: you have to either read the response body or close the connection because of the limitation of 6 outbound connections.",
"fromVersion": "23.08",
"toVersion": null,
"private": true
}
38 changes: 38 additions & 0 deletions http-caller-post/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export function getDescription() {
return {
description: "HTTP Caller POST",
input: [
{
id: "post",
displayName: "URL POST",
description: "URL to call - method POST",
type: "Connector",
},
{
id: "body",
displayName: "Body",
description: "Body to send to the endpoint",
type: "String",
}
],
output: [],
} as const satisfies ScriptDescription;
}

export async function execute(context): Promise<Output> {
const headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Accept", "application/json");
const body = context.parameters.body;

const requestOptions = {
headers: headers,
method: "POST",
body: body,
};

const requestEndpoint = context.parameters.post;
const response = await fetch(requestEndpoint, requestOptions);
const responseJson = await response.json();
console.debug(responseJson);
}
8 changes: 8 additions & 0 deletions http-caller-post/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "http-caller-post",
"displayName": "HTTP Caller - POST request",
"description": "Provides an example of a POST request. Requires a Web endpoint type connector. WARNING: you have to either read the response body or close the connection because of the limitation of 6 outbound connections.",
"fromVersion": "23.08",
"toVersion": null,
"private": true
}