Skip to content

Commit b04188f

Browse files
js07dannyroosevelt
andauthored
[Docs] Add Connect API endpoint for updating a deployed trigger (#16493)
--------- Co-authored-by: Danny Roosevelt <danny@pipedream.com>
1 parent 66db670 commit b04188f

File tree

1 file changed

+201
-0
lines changed

1 file changed

+201
-0
lines changed

docs-v2/pages/connect/api.mdx

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,6 +2797,207 @@ curl -X DELETE \
27972797

27982798
Pipedream returns a `204 No Content` response on successful deletion
27992799

2800+
#### Update Deployed Trigger
2801+
2802+
Update a deployed trigger for a given user.
2803+
2804+
```text
2805+
PUT /deployed-triggers/{deployed_trigger_id}/
2806+
```
2807+
2808+
##### Path parameters
2809+
2810+
`deployed_trigger_id` **string**
2811+
2812+
The deployed trigger ID for the trigger you'd like to update (ex, `dc_xxxxxxx`).
2813+
2814+
##### Query parameters
2815+
2816+
`external_user_id` **string**
2817+
2818+
[The external user ID](/connect/api/#external-users) in your system on behalf of
2819+
which you want to update the trigger.
2820+
2821+
##### Body parameters
2822+
2823+
`active` **boolean** (_optional_)
2824+
2825+
The state to which the trigger should be updated.
2826+
2827+
`configured_props` **object** (_optional_)
2828+
2829+
The new configuration props for the trigger.
2830+
2831+
`name` **string** (_optional_)
2832+
2833+
The new name of the trigger.
2834+
2835+
##### Examples
2836+
2837+
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
2838+
2839+
<Tabs.Tab>
2840+
```typescript
2841+
import {
2842+
createBackendClient,
2843+
type GetTriggerResponse,
2844+
type V1DeployedComponent,
2845+
type BackendClient,
2846+
type BackendClientOpts,
2847+
type UpdateTriggerOpts,
2848+
} from "@pipedream/sdk/server";
2849+
2850+
const clientOpts: BackendClientOpts = {
2851+
environment: "development", // change to production if running for a test production account, or in production
2852+
credentials: {
2853+
clientId: "{oauth_client_id}",
2854+
clientSecret: "{oauth_client_secret}",
2855+
},
2856+
projectId: "{your_project_id}"
2857+
};
2858+
const pd: BackendClient = createBackendClient(clientOpts);
2859+
2860+
// Update the deployed trigger for the specified user
2861+
const requestOpts: UpdateTriggerOpts = {
2862+
id: "dc_gzumK2e",
2863+
externalUserId: "jverce",
2864+
active: true,
2865+
name: "My Updated Trigger",
2866+
configuredProps: {
2867+
gitlab: {
2868+
authProvisionId: "apn_kVh9AoD",
2869+
},
2870+
projectId: 45672542,
2871+
},
2872+
};
2873+
const response: GetTriggerResponse = await pd.updateTrigger(requestOpts);
2874+
2875+
const {
2876+
data: trigger, // The updated deployed trigger
2877+
}: {
2878+
data: V1DeployedComponent,
2879+
} = response;
2880+
```
2881+
</Tabs.Tab>
2882+
2883+
<Tabs.Tab>
2884+
```javascript
2885+
import {
2886+
createBackendClient,
2887+
} from "@pipedream/sdk/server";
2888+
2889+
const pd = createBackendClient({
2890+
environment: "development", // change to production if running for a test production account, or in production
2891+
credentials: {
2892+
clientId: "{oauth_client_id}",
2893+
clientSecret: "{oauth_client_secret}",
2894+
},
2895+
projectId: "{your_project_id}"
2896+
});
2897+
2898+
// Update the deployed trigger for the specified user
2899+
const requestOpts = {
2900+
id: "dc_gzumK2e",
2901+
externalUserId: "jverce",
2902+
active: true,
2903+
name: "My Updated Trigger",
2904+
configuredProps: {
2905+
gitlab: {
2906+
authProvisionId: "apn_kVh9AoD",
2907+
},
2908+
projectId: 45672542,
2909+
},
2910+
};
2911+
const { data: deployedTrigger } = await pd.updateTrigger(requestOpts);
2912+
2913+
// Parse and return the data you need
2914+
```
2915+
</Tabs.Tab>
2916+
2917+
<Tabs.Tab>
2918+
```bash
2919+
# First, obtain an OAuth access token
2920+
curl -X POST https://api.pipedream.com/v1/oauth/token \
2921+
-H "Content-Type: application/json" \
2922+
-d '{
2923+
"grant_type": "client_credentials",
2924+
"client_id": "{oauth_client_id}",
2925+
"client_secret": "{oauth_client_secret}"
2926+
}'
2927+
2928+
# The response will include an access_token. Use it in the Authorization header below.
2929+
# This request will update the deployed trigger for the specified user.
2930+
2931+
curl -X PUT "https://api.pipedream.com/v1/connect/{your_project_id}/deployed-triggers/{deployed_trigger_id}/" \
2932+
-H "Authorization: Bearer {access_token}" \
2933+
-H "Content-Type: application/json" \
2934+
-H "x-pd-environment: development" \
2935+
-d '{
2936+
"external_user_id": "jverce",
2937+
"active": true,
2938+
"configured_props": {
2939+
"gitlab": {
2940+
"authProvisionId": "apn_kVh9AoD"
2941+
},
2942+
"projectId": 45672542,
2943+
},
2944+
"name": "My Updated Trigger"
2945+
}'
2946+
```
2947+
</Tabs.Tab>
2948+
</Tabs>
2949+
2950+
##### Example response
2951+
2952+
```json
2953+
{
2954+
"data": {
2955+
"id": "dc_dAuGmW7",
2956+
"owner_id": "exu_oedidz",
2957+
"component_id": "sc_3vijzQr",
2958+
"configurable_props": [
2959+
{
2960+
"name": "gitlab",
2961+
"type": "app",
2962+
"app": "gitlab"
2963+
},
2964+
{
2965+
"name": "db",
2966+
"type": "$.service.db"
2967+
},
2968+
{
2969+
"name": "http",
2970+
"type": "$.interface.http",
2971+
"customResponse": true
2972+
},
2973+
{
2974+
"name": "projectId",
2975+
"type": "integer",
2976+
"label": "Project ID",
2977+
"description": "The project ID, as displayed in the main project page",
2978+
"remoteOptions": true
2979+
}
2980+
],
2981+
"configured_props": {
2982+
"gitlab": {
2983+
"authProvisionId": "apn_kVh9AoD"
2984+
},
2985+
"db": {
2986+
"type": "$.service.db"
2987+
},
2988+
"http": {
2989+
"endpoint_url": "https://xxxxxxxxxx.m.pipedream.net"
2990+
},
2991+
"projectId": 45672542
2992+
},
2993+
"active": true,
2994+
"created_at": 1734028283,
2995+
"updated_at": 1734038486,
2996+
"name": "My Updated Trigger",
2997+
"name_slug": "my-updated-trigger"
2998+
}
2999+
}
3000+
```
28003001

28013002
#### Retrieve Events Emitted by Deployed Trigger
28023003

0 commit comments

Comments
 (0)