diff --git a/docs-v2/pages/connect/api.mdx b/docs-v2/pages/connect/api.mdx index 151803177f953..3ca1fbeacdb71 100644 --- a/docs-v2/pages/connect/api.mdx +++ b/docs-v2/pages/connect/api.mdx @@ -2797,6 +2797,207 @@ curl -X DELETE \ Pipedream returns a `204 No Content` response on successful deletion +#### Update Deployed Trigger + +Update a deployed trigger for a given user. + +```text +PUT /deployed-triggers/{deployed_trigger_id}/ +``` + +##### Path parameters + +`deployed_trigger_id` **string** + +The deployed trigger ID for the trigger you'd like to update (ex, `dc_xxxxxxx`). + +##### Query parameters + +`external_user_id` **string** + +[The external user ID](/connect/api/#external-users) in your system on behalf of +which you want to update the trigger. + +##### Body parameters + +`active` **boolean** (_optional_) + +The state to which the trigger should be updated. + +`configured_props` **object** (_optional_) + +The new configuration props for the trigger. + +`name` **string** (_optional_) + +The new name of the trigger. + +##### Examples + + + + +```typescript +import { + createBackendClient, + type GetTriggerResponse, + type V1DeployedComponent, + type BackendClient, + type BackendClientOpts, + type UpdateTriggerOpts, +} from "@pipedream/sdk/server"; + +const clientOpts: BackendClientOpts = { + environment: "development", // change to production if running for a test production account, or in production + credentials: { + clientId: "{oauth_client_id}", + clientSecret: "{oauth_client_secret}", + }, + projectId: "{your_project_id}" +}; +const pd: BackendClient = createBackendClient(clientOpts); + +// Update the deployed trigger for the specified user +const requestOpts: UpdateTriggerOpts = { + id: "dc_gzumK2e", + externalUserId: "jverce", + active: true, + name: "My Updated Trigger", + configuredProps: { + gitlab: { + authProvisionId: "apn_kVh9AoD", + }, + projectId: 45672542, + }, +}; +const response: GetTriggerResponse = await pd.updateTrigger(requestOpts); + +const { + data: trigger, // The updated deployed trigger +}: { + data: V1DeployedComponent, +} = response; +``` + + + +```javascript +import { + createBackendClient, +} from "@pipedream/sdk/server"; + +const pd = createBackendClient({ + environment: "development", // change to production if running for a test production account, or in production + credentials: { + clientId: "{oauth_client_id}", + clientSecret: "{oauth_client_secret}", + }, + projectId: "{your_project_id}" +}); + +// Update the deployed trigger for the specified user +const requestOpts = { + id: "dc_gzumK2e", + externalUserId: "jverce", + active: true, + name: "My Updated Trigger", + configuredProps: { + gitlab: { + authProvisionId: "apn_kVh9AoD", + }, + projectId: 45672542, + }, +}; +const { data: deployedTrigger } = await pd.updateTrigger(requestOpts); + +// Parse and return the data you need +``` + + + +```bash +# First, obtain an OAuth access token +curl -X POST https://api.pipedream.com/v1/oauth/token \ + -H "Content-Type: application/json" \ + -d '{ + "grant_type": "client_credentials", + "client_id": "{oauth_client_id}", + "client_secret": "{oauth_client_secret}" + }' + +# The response will include an access_token. Use it in the Authorization header below. +# This request will update the deployed trigger for the specified user. + +curl -X PUT "https://api.pipedream.com/v1/connect/{your_project_id}/deployed-triggers/{deployed_trigger_id}/" \ + -H "Authorization: Bearer {access_token}" \ + -H "Content-Type: application/json" \ + -H "x-pd-environment: development" \ + -d '{ + "external_user_id": "jverce", + "active": true, + "configured_props": { + "gitlab": { + "authProvisionId": "apn_kVh9AoD" + }, + "projectId": 45672542, + }, + "name": "My Updated Trigger" + }' +``` + + + +##### Example response + +```json +{ + "data": { + "id": "dc_dAuGmW7", + "owner_id": "exu_oedidz", + "component_id": "sc_3vijzQr", + "configurable_props": [ + { + "name": "gitlab", + "type": "app", + "app": "gitlab" + }, + { + "name": "db", + "type": "$.service.db" + }, + { + "name": "http", + "type": "$.interface.http", + "customResponse": true + }, + { + "name": "projectId", + "type": "integer", + "label": "Project ID", + "description": "The project ID, as displayed in the main project page", + "remoteOptions": true + } + ], + "configured_props": { + "gitlab": { + "authProvisionId": "apn_kVh9AoD" + }, + "db": { + "type": "$.service.db" + }, + "http": { + "endpoint_url": "https://xxxxxxxxxx.m.pipedream.net" + }, + "projectId": 45672542 + }, + "active": true, + "created_at": 1734028283, + "updated_at": 1734038486, + "name": "My Updated Trigger", + "name_slug": "my-updated-trigger" + } +} +``` #### Retrieve Events Emitted by Deployed Trigger