Skip to content

Commit 8f7acfe

Browse files
committed
getAccounts changes
1 parent f5d7c0c commit 8f7acfe

File tree

3 files changed

+40
-681
lines changed

3 files changed

+40
-681
lines changed

docs-v2/pages/connect/api.mdx

Lines changed: 20 additions & 327 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ GET /{project_id}/accounts/
314314

315315
##### Query parameters
316316

317+
`app` **string** (_optional_)
318+
319+
The ID or name slug the app you'd like to retrieve. For example, Slack's unique app ID is `app_OkrhR1`, and its name slug is `slack`.
320+
321+
You can find the app's ID in the response from the [List apps](#list-apps) endpoint, and the name slug under the **Authentication** section of any [app page](https://pipedream.com/apps).
322+
323+
---
324+
325+
`oauth_app_id` **string** (_optional_)
326+
327+
The ID of the custom [OAuth app](/connect/quickstart#creating-a-custom-oauth-client) you'd like to retrieve accounts for.
328+
329+
---
330+
331+
`external_user_id` **string** (_optional_)
332+
333+
[The external user ID](/connect/api/#external-users) in your system that you want to retrieve accounts for.
334+
335+
---
336+
317337
`include_credentials` **boolean** (_optional_)
318338

319339
Pass `include_credentials=true` as a query-string parameter to include the account credentials in the response
@@ -456,118 +476,6 @@ curl -X GET "https://api.pipedream.com/v1/connect/{project_id}/accounts/?include
456476
}
457477
```
458478

459-
#### List all accounts for an app
460-
461-
```
462-
GET /{project_id}/apps/{app_id}/accounts
463-
```
464-
465-
##### Path parameters
466-
467-
`project_id` **string**
468-
469-
[The project's ID](/projects#finding-your-projects-id)
470-
471-
---
472-
473-
- `app_id` **string**
474-
475-
The `oauth_app_id` for [OAuth apps](/connect/quickstart#creating-a-custom-oauth-client) or [name slug](/connect/quickstart/#find-your-apps-name-slug) for key-based apps
476-
477-
##### Query parameters
478-
479-
`include_credentials` **boolean** (_optional_)
480-
481-
Pass `include_credentials=true` as a query-string parameter to include the account credentials in the response
482-
483-
##### Examples
484-
485-
<Tabs items={['TypeScript (Next.js)', 'Node.js', 'HTTP (cURL)']}>
486-
<Tabs.Tab>
487-
```typescript
488-
import {
489-
createBackendClient,
490-
} from "@pipedream/sdk";
491-
492-
const pd = createBackendClient({
493-
credentials: {
494-
clientId: "your-oauth-client-id",
495-
clientSecret: "your-oauth-client-secret",
496-
}
497-
});
498-
499-
const accounts = await pd.getAccountsByApp(appId, {
500-
include_credentials: true, // set to true to include credentials
501-
});
502-
503-
// Parse and return the data you need. These may contain credentials,
504-
// which you should never return to the client
505-
```
506-
</Tabs.Tab>
507-
<Tabs.Tab>
508-
```javascript
509-
import { createBackendClient } from "@pipedream/sdk";
510-
511-
const pd = createBackendClient({
512-
credentials: {
513-
clientId: "your-oauth-client-id",
514-
clientSecret: "your-oauth-client-secret",
515-
}
516-
});
517-
518-
const accounts = await pd.getAccountsByApp(appId, {
519-
include_credentials: true, // set to true to include credentials
520-
});
521-
522-
// Parse and return the data you need. These may contain credentials,
523-
// which you should never return to the client
524-
```
525-
</Tabs.Tab>
526-
<Tabs.Tab>
527-
```bash
528-
# First, obtain an OAuth access token
529-
curl -X POST https://api.pipedream.com/v1/oauth/token \
530-
-H "Content-Type: application/json" \
531-
-d '{
532-
"grant_type": "client_credentials",
533-
"client_id": "{oauth_client_id}",
534-
"client_secret": "{oauth_client_secret}"
535-
}'
536-
537-
# The response will include an access_token. Use it in the Authorization header below.
538-
539-
curl -X GET "https://api.pipedream.com/v1/connect/{project_id}/apps/{app_id}/accounts?include_credentials=true" \
540-
-H "Authorization: Bearer {access_token}"
541-
```
542-
</Tabs.Tab>
543-
</Tabs>
544-
545-
##### Example response
546-
547-
```json
548-
[
549-
{
550-
"id": "apn_WYhMlrz",
551-
"name": null,
552-
"external_id": "user-abc-123",
553-
"healthy": true,
554-
"dead": false,
555-
"app": {
556-
"id": "oa_aw4ib2",
557-
"name_slug": "airtable_oauth",
558-
"name": "Airtable",
559-
"auth_type": "oauth",
560-
"description": "Airtable is a low-code platform to build next-gen apps. Move beyond rigid tools, operationalize your critical data, and reimagine workflows with AI.",
561-
"img_src": "https://assets.pipedream.net/s.v0/app_XBxhAl/logo/orig",
562-
"custom_fields_json": "[]",
563-
"categories": ["Productivity"]
564-
},
565-
"created_at": "2024-08-01T04:04:03.000Z",
566-
"updated_at": "2024-08-01T04:04:03.000Z"
567-
}
568-
]
569-
```
570-
571479
#### Retrieve account details by ID
572480

573481
Retrieve the account details for a specific account based on the account ID
@@ -716,221 +624,6 @@ curl -X GET "https://api.pipedream.com/v1/connect/{project_id}/accounts/{account
716624
}
717625
```
718626

719-
#### Retrieve accounts for an external user
720-
721-
Retrieve the account details for a specific account based on the external user ID
722-
723-
```
724-
GET /{project_id}/users/{external_user_id}/accounts
725-
```
726-
727-
##### Path parameters
728-
729-
`project_id` **string**
730-
731-
[The project's ID](/projects#finding-your-projects-id)
732-
733-
---
734-
735-
`external_user_id` **string**
736-
737-
[The external user ID](#external-users) in your system that you want to retrieve accounts for.
738-
739-
##### Query parameters
740-
741-
`include_credentials` **boolean** (_optional_)
742-
743-
Pass `include_credentials=true` as a query-string parameter to include the account credentials in the response
744-
745-
##### Examples
746-
747-
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
748-
<Tabs.Tab>
749-
```typescript
750-
import {
751-
createBackendClient,
752-
} from "@pipedream/sdk";
753-
754-
const pd = createBackendClient({
755-
credentials: {
756-
clientId: "your-oauth-client-id",
757-
clientSecret: "your-oauth-client-secret",
758-
}
759-
});
760-
761-
await pd.getAccountsByExternalId(externalId, {
762-
include_credentials: true, // set to true to include credentials
763-
})
764-
765-
// Parse and return the data you need. These may contain credentials,
766-
// which you should never return to the client
767-
```
768-
</Tabs.Tab>
769-
<Tabs.Tab>
770-
```javascript
771-
import { createBackendClient } from "@pipedream/sdk";
772-
773-
const pd = createBackendClient({
774-
credentials: {
775-
clientId: "your-oauth-client-id",
776-
clientSecret: "your-oauth-client-secret",
777-
}
778-
});
779-
780-
const externalId = "{external_user_id}"; // Replace with your external user ID
781-
782-
const accounts = await pd.getAccountsByExternalId(externalId, {
783-
include_credentials: true, // set to true to include credentials
784-
});
785-
786-
// Parse and return the data you need. These may contain credentials,
787-
// which you should never return to the client
788-
```
789-
</Tabs.Tab>
790-
<Tabs.Tab>
791-
```bash
792-
# First, obtain an OAuth access token
793-
curl -X POST https://api.pipedream.com/v1/oauth/token \
794-
-H "Content-Type: application/json" \
795-
-d '{
796-
"grant_type": "client_credentials",
797-
"client_id": "{oauth_client_id}",
798-
"client_secret": "{oauth_client_secret}"
799-
}'
800-
801-
# The response will include an access_token. Use it in the Authorization header below.
802-
803-
curl -X GET "https://api.pipedream.com/v1/connect/{project_id}/users/{external_user_id}/accounts?include_credentials=true" \
804-
-H "Authorization: Bearer {access_token}"
805-
```
806-
</Tabs.Tab>
807-
</Tabs>
808-
809-
##### Example response (without account credentials)
810-
811-
```json
812-
[
813-
{
814-
"id": "apn_WYhM5ov",
815-
"name": null,
816-
"external_id": "user-abc-123",
817-
"healthy": true,
818-
"dead": false,
819-
"app": {
820-
"id": "oa_aw4ib2",
821-
"name_slug": "airtable_oauth",
822-
"name": "Airtable",
823-
"auth_type": "oauth",
824-
"description": "Airtable is a low-code platform to build next-gen apps. Move beyond rigid tools, operationalize your critical data, and reimagine workflows with AI.",
825-
"img_src": "https://assets.pipedream.net/s.v0/app_XBxhAl/logo/orig",
826-
"custom_fields_json": "[]",
827-
"categories": [
828-
"Productivity"
829-
]
830-
},
831-
"created_at": "2024-08-06T21:51:30.000Z",
832-
"updated_at": "2024-08-06T21:51:30.000Z",
833-
"expires_at": "2024-08-06T22:51:30.000Z",
834-
"error": null,
835-
"last_refreshed_at": null,
836-
"next_refresh_at": "2024-08-06T22:04:41.000Z"
837-
},
838-
{
839-
"id": "apn_KAh7JwW",
840-
"name": null,
841-
"external_id": "user-abc-123",
842-
"healthy": true,
843-
"dead": false,
844-
"app": {
845-
"id": "oa_aPXiQd",
846-
"name_slug": "github",
847-
"name": "GitHub",
848-
"auth_type": "oauth",
849-
"description": "Where the world builds software. Millions of developers and companies build, ship, and maintain their software on GitHub—the largest and most advanced development platform in the world.",
850-
"img_src": "https://assets.pipedream.net/s.v0/app_OrZhaO/logo/orig",
851-
"custom_fields_json": "[]",
852-
"categories": [
853-
"Developer Tools"
854-
]
855-
},
856-
"created_at": "2024-08-06T21:53:05.000Z",
857-
"updated_at": "2024-08-06T21:53:05.000Z",
858-
"expires_at": null,
859-
"error": null,
860-
"last_refreshed_at": null,
861-
"next_refresh_at": "2024-08-06T22:50:01.000Z"
862-
}
863-
]
864-
```
865-
866-
##### Example Response (with `include_credentials=true`)
867-
868-
```json
869-
[
870-
{
871-
"id": "apn_WYhM5ov",
872-
"name": null,
873-
"external_id": "user-abc-123",
874-
"healthy": true,
875-
"dead": false,
876-
"app": {
877-
"id": "oa_aw4ib2",
878-
"name_slug": "airtable_oauth",
879-
"name": "Airtable",
880-
"auth_type": "oauth",
881-
"description": "Airtable is a low-code platform to build next-gen apps. Move beyond rigid tools, operationalize your critical data, and reimagine workflows with AI.",
882-
"img_src": "https://assets.pipedream.net/s.v0/app_XBxhAl/logo/orig",
883-
"custom_fields_json": "[]",
884-
"categories": [
885-
"Productivity"
886-
]
887-
},
888-
"created_at": "2024-08-06T21:51:30.000Z",
889-
"updated_at": "2024-08-06T21:51:30.000Z",
890-
"credentials": {
891-
"oauth_client_id": "dd7a26ca-ba11-4f80-8667-xxxxxxxx",
892-
"oauth_access_token": "oaaLa2Ob1umiregWa.v1.xxxxxxxx.xxxxxxxx",
893-
"oauth_refresh_token": "oaaLa2Ob1umiregWa.v1.refresh.xxxxxxxx",
894-
"oauth_uid": "usrnbIhrxxxxxxxx"
895-
},
896-
"expires_at": "2024-08-06T22:51:30.000Z",
897-
"error": null,
898-
"last_refreshed_at": null,
899-
"next_refresh_at": "2024-08-06T22:04:41.000Z"
900-
},
901-
{
902-
"id": "apn_KAh7JwW",
903-
"name": null,
904-
"external_id": "user-abc-123",
905-
"healthy": true,
906-
"dead": false,
907-
"app": {
908-
"id": "oa_aPXiQd",
909-
"name_slug": "github",
910-
"name": "GitHub",
911-
"auth_type": "oauth",
912-
"description": "Where the world builds software. Millions of developers and companies build, ship, and maintain their software on GitHub—the largest and most advanced development platform in the world.",
913-
"img_src": "https://assets.pipedream.net/s.v0/app_OrZhaO/logo/orig",
914-
"custom_fields_json": "[]",
915-
"categories": [
916-
"Developer Tools"
917-
]
918-
},
919-
"created_at": "2024-08-06T21:53:05.000Z",
920-
"updated_at": "2024-08-06T21:53:05.000Z",
921-
"credentials": {
922-
"oauth_client_id": "57dc28xxxxxxxxxxxxx",
923-
"oauth_access_token": "gho_xxxxxxxxxxxxxxxxxx",
924-
"oauth_uid": "104484339"
925-
},
926-
"expires_at": null,
927-
"error": null,
928-
"last_refreshed_at": null,
929-
"next_refresh_at": "2024-08-06T22:50:01.000Z"
930-
}
931-
]
932-
```
933-
934627
#### Delete connected account
935628

936629
Delete a specific connected account for an end user

0 commit comments

Comments
 (0)