Skip to content

Commit c1d931e

Browse files
committed
[Docs] Add Connect API endpoint for updating a deployed trigger
1 parent 49f4eb1 commit c1d931e

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed

docs-v2/pages/connect/api.mdx

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,151 @@ The deployed trigger ID for the trigger you'd like to retrieve (ex, `dc_xxxxxxx`
27092709
[The external user ID](/connect/api/#external-users) in your system on behalf of
27102710
which you want to deploy the trigger.
27112711

2712+
#### Update a deployed trigger
2713+
2714+
Update a deployed trigger for a given user.
2715+
2716+
```text
2717+
PUT /deployed-triggers/{deployed_trigger_id}
2718+
```
2719+
2720+
##### Path parameters
2721+
2722+
`deployed_trigger_id` **string**
2723+
2724+
The deployed trigger ID for the trigger you'd like to update (ex, `dc_xxxxxxx`).
2725+
2726+
##### Query parameters
2727+
2728+
`external_user_id` **string**
2729+
2730+
[The external user ID](/connect/api/#external-users) in your system on behalf of
2731+
which you want to update the trigger.
2732+
2733+
##### Body parameters
2734+
2735+
`active` **boolean** (_optional_)
2736+
2737+
The state to which the trigger should be updated.
2738+
2739+
`configured_props` **object** (_optional_)
2740+
2741+
The new configuration props for the trigger.
2742+
2743+
`name` **string** (_optional_)
2744+
2745+
The new name of the trigger.
2746+
2747+
##### Examples
2748+
2749+
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
2750+
2751+
<Tabs.Tab>
2752+
```typescript
2753+
import {
2754+
createBackendClient,
2755+
GetTriggerResponse,
2756+
V1DeployedComponent,
2757+
type BackendClient,
2758+
type BackendClientOpts,
2759+
type UpdateTriggerOpts,
2760+
} from "@pipedream/sdk/server";
2761+
2762+
const clientOpts: BackendClientOpts = {
2763+
environment: "development", // change to production if running for a test production account, or in production
2764+
credentials: {
2765+
clientId: "{oauth_client_id}",
2766+
clientSecret: "{oauth_client_secret}",
2767+
},
2768+
projectId: "{your_project_id}"
2769+
};
2770+
const pd: BackendClient = createBackendClient(clientOpts);
2771+
2772+
// Update the deployed trigger for the specified user
2773+
const requestOpts: UpdateTriggerOpts = {
2774+
id: "dc_gzumK2e",
2775+
externalUserId: "jverce",
2776+
active: true,
2777+
name: "My Updated Trigger",
2778+
configuredProps: {
2779+
gitlab: {
2780+
authProvisionId: "apn_kVh9AoD",
2781+
},
2782+
projectId: 45672542,
2783+
},
2784+
};
2785+
const response: GetTriggerResponse = await pd.updateTrigger(requestOpts);
2786+
2787+
const {
2788+
data: trigger, // The updated deployed trigger
2789+
}: {
2790+
data: V1DeployedComponent,
2791+
} = response;
2792+
```
2793+
</Tabs.Tab>
2794+
2795+
<Tabs.Tab>
2796+
```javascript
2797+
import {
2798+
createBackendClient,
2799+
} from "@pipedream/sdk/server";
2800+
2801+
const pd = createBackendClient({
2802+
environment: "development", // change to production if running for a test production account, or in production
2803+
credentials: {
2804+
clientId: "{oauth_client_id}",
2805+
clientSecret: "{oauth_client_secret}",
2806+
},
2807+
projectId: "{your_project_id}"
2808+
});
2809+
2810+
// Update the deployed trigger for the specified user
2811+
const requestOpts = {
2812+
id: "dc_gzumK2e",
2813+
externalUserId: "jverce",
2814+
active: true,
2815+
name: "My Updated Trigger",
2816+
configuredProps: {
2817+
gitlab: {
2818+
authProvisionId: "apn_kVh9AoD",
2819+
},
2820+
projectId: 45672542,
2821+
},
2822+
};
2823+
const { data: deployedTrigger } = await pd.updateTrigger(requestOpts);
2824+
2825+
// Parse and return the data you need
2826+
```
2827+
</Tabs.Tab>
2828+
2829+
<Tabs.Tab>
2830+
```bash
2831+
# First, obtain an OAuth access token
2832+
curl -X POST https://api.pipedream.com/v1/oauth/token \
2833+
-H "Content-Type: application/json" \
2834+
-d '{
2835+
"grant_type": "client_credentials",
2836+
"client_id": "{oauth_client_id}",
2837+
"client_secret": "{oauth_client_secret}"
2838+
}'
2839+
2840+
# The response will include an access_token. Use it in the Authorization header below.
2841+
# This request will update the deployed trigger for the specified user.
2842+
2843+
curl -X PUT "https://api.pipedream.com/v1/connect/{your_project_id}/deployed-triggers/{deployed_trigger_id}/" \
2844+
-H "Authorization: Bearer {access_token}" \
2845+
-H "Content-Type: application/json" \
2846+
-H "x-pd-environment: development" \
2847+
-d '{
2848+
"external_user_id": "jverce",
2849+
"active": true,
2850+
"configured_props": {},
2851+
"name": "My Updated Trigger"
2852+
}'
2853+
```
2854+
</Tabs.Tab>
2855+
2856+
</Tabs>
27122857

27132858
##### Examples
27142859

0 commit comments

Comments
 (0)