You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-v2/pages/connect/api-proxy.mdx
+27-54Lines changed: 27 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,43 +33,36 @@ You can send requests to the Connect proxy using the [Pipedream SDK](/connect/sd
33
33
34
34
Refer to the full Connect API [here](/connect/api/).
35
35
36
-
### Authenticating on behalf of your user
36
+
### Authenticating on behalf of your users
37
37
38
-
Most API integrations that use OAuth to authenticate requests require that you pass a user's access token in the `Authorization` header with the `Bearer` prefix. For these apps, the Connect proxy will automatically handle that for you — you don't need to pass any reference to their OAuth access token in this case.
38
+
One of the core benefits of using the Connect API Proxy is not having to deal with storing or retrieving sensitive credentials for your end users.
39
39
40
-
For apps that require a different authentication method, you should include the necessary headers with the value surrounded by `{{ }}` in your request to the proxy, and Pipedream will automatically replace the macro with the real values and forward to the upstream API. For example:
40
+
Since Pipedream has {process.env.PUBLIC_APPS}+ integrated apps, we know how the upstream APIs are expecting to receive access tokens or API keys. When you send a request to the proxy, Pipedream will look up the corresponding connected account for the relevant user, and **automatically insert the authorization credentials in the appropriate header or URL param**.
41
41
42
-
```javascript
43
-
/*
44
-
OpenAI requires that you pass the API key
45
-
in the `Authorization` header with the `Bearer` prefix:
46
-
*/
42
+
### Sending requests
47
43
48
-
headers: {
49
-
authorization:"Bearer {{api_key}}",
50
-
}
44
+
**URL**
51
45
52
-
// Pipedream will replace the `{{api_key}}` macro with the actual API key
53
-
```
46
+
- The URL of the API you want to call (ex, `https://slack.com/api/chat.postMessage`)
47
+
- When using the REST API, this should be an URL-safe Base64 encoded string (ex, `aHR0cHM6Ly9zbGFjay5jb20vYXBpL2NoYXQucG9zdE1lc3NhZ2U`)
54
48
55
-
```javascript
56
-
/*
57
-
Zoho apps require that you pass the OAuth access token
58
-
in the `Authorization` header with a custom `Zoho-oauthtoken` prefix:
59
-
*/
49
+
<Callouttype="info">
50
+
- Some APIs like Zendesk, Zoho, and others use dynamic base domains that are account-specific (e.g, `https://foo.zendesk.com`). For any of these apps, you should pass a relative path as the `url` in your proxy request, like `/api/v2/chat/chats` for example.
51
+
- Those dynamic fields are typically defined by the end user during the account connection flow, so the domain value will be stored as part of their connected account credentials in Pipedream.
// Pipedream will replace the `{{oauth_access_token}}` macro with the actual token
66
-
```
56
+
- Use the HTTP method required by the upstream API
67
57
68
-
<Callouttype="info">
69
-
Refer to the relevant API's developer documentation for the correct way to authenticate requests.
70
-
</Callout>
58
+
**Body**
59
+
60
+
- Optionally include a body to send to the upstream API
71
61
72
-
### Making a request
62
+
**Headers**
63
+
64
+
- If using the REST API, include the `Authorization` header with your Pipedream OAuth access token (`Bearer {access_token}`)
65
+
- Headers that contain the prefix `x-pd-proxy` will get forwarded to the upstream API
73
66
74
67
#### Using the Pipedream SDK
75
68
@@ -80,7 +73,7 @@ import { createBackendClient } from "@pipedream/sdk/server";
80
73
81
74
constpd=createBackendClient({
82
75
environment: {development | production},
83
-
projectId: {your_projectId},
76
+
projectId: {your_pipedream_project_i_d},
84
77
credentials: {
85
78
clientId: {your_oauth_client_id},
86
79
clientSecret: {your_oauth_client_secret}
@@ -116,30 +109,7 @@ console.log(resp);
116
109
117
110
#### Using the REST API
118
111
119
-
You can also send a request to the Connect REST API with the below config:
120
-
121
-
**URL**
122
-
123
-
- The URL of the API you want to call (ex, `https://slack.com/api/chat.postMessage`)
124
-
- When using the REST API, this should be an URL-safe Base64 encoded string (ex, `aHR0cHM6Ly9zbGFjay5jb20vYXBpL2NoYXQucG9zdE1lc3NhZ2U`)
125
-
126
-
**HTTP method**
127
-
128
-
- Use the HTTP method required by the upstream API
129
-
130
-
**Body**
131
-
132
-
- Optionally include a body to send to the upstream API
133
-
134
-
**Headers**
135
-
136
-
- If using the REST API, include the `Authorization` header with your Pipedream OAuth access token (`Bearer {access_token}`)
137
-
- Headers that contain the prefix `x-pd-proxy` will get forwarded to the upstream API
138
-
- If the upstream API requires [custom authorization headers](#authenticating-on-behalf-of-your-user), make sure to prepend with `x-pd-proxy` and include the macro `{{ }}` that Pipedream will replace with the actual value. For example,
139
-
140
-
```javascript
141
-
"x-pd-proxy-apiKey: {{api_key}}"
142
-
```
112
+
You can also use the Connect REST API directly. If using the REST API, send your Pipedream OAuth access token in the `Authorization` header:
143
113
144
114
```bash
145
115
# First, obtain an OAuth access token to authenticate to the Pipedream API
@@ -165,6 +135,9 @@ curl -X POST "https://api.pipedream.com/v1/connect/{your_project_id}/proxy/{url_
165
135
# Parse and return the data you need
166
136
```
167
137
168
-
## Rate limits
138
+
## Limits
169
139
170
-
The Connect proxy limits API requests to **100 per minute per project**. [Let us know](https://pipedream.com/support) if you need higher limits.
140
+
The Connect proxy limits API requests to,
141
+
- 100 requests per minute per project. Requests that surpass this limit will receive a `429` response.
142
+
- A maximum timeout of 30 seconds. Requests that take longer than 30 seconds will be terminated, and Pipedream will return a `504` error to the caller.
143
+
-[Let us know](https://pipedream.com/support) if you need higher limits.
0 commit comments