-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3693 from MoShizzle/arbitrary-request
feat: arbitrary http request action
- Loading branch information
Showing
5 changed files
with
137 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "Enable Custom API Calls" | ||
description: "Learn how to enable custom API calls for your pieces" | ||
icon: 'circle-3' | ||
--- | ||
|
||
Custom API Calls allow the user to send a request to a specific endpoint if no action has been implemented for it. This will show in the actions list of the piece as `Custom API Call`. | ||
|
||
To enable this action for a piece, you need to call the `createCustomApiCallAction` in your actions array. | ||
|
||
## Example | ||
|
||
The example below implements the action for the OpenAI piece. The OpenAI piece uses a `Bearer token` authorization header to identify the user sending the request. | ||
|
||
```typescript | ||
actions: [ | ||
...yourActions, | ||
createCustomApiCallAction({ | ||
// The auth object defined in the piece | ||
auth: openaiAuth, | ||
// The base URL for the API | ||
baseUrl: 'https://api.openai.com/v1', | ||
// Mapping the auth object to the needed authorization headers | ||
authMapping: (auth: PieceAuthProperty) => { | ||
return { | ||
'Authorization': `Bearer ${auth}` | ||
} | ||
} | ||
}) | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@activepieces/pieces-common", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "@activepieces/piece-openai", | ||
"version": "0.3.14" | ||
"version": "0.3.15" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters