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: src/connections/sources/catalog/libraries/server/http-api/index.md
+35-11Lines changed: 35 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,28 @@ Segment has native [sources](/docs/connections/sources/) for most use cases (lik
11
11
12
12
### Authentication
13
13
14
-
Choose between [basic authentication](#basic-authentication) and [OAuth](#oauth) to authenticate requests.
15
-
16
-
#### Basic authentication
14
+
Choose between [writeKey authentication](#writeKey-authentication), [basic authentication](#basic-authentication) and [OAuth](#oauth) to authenticate requests.
17
15
16
+
#### writeKey authentication
18
17
Authenticate to the Tracking API by sending your project's **Write Key** along with a request.
19
-
Authentication uses HTTP Basic Auth, which involves a `username:password` that is base64 encoded and prepended with the string `Basic`.
18
+
The authentication writeKey should be sent as part of the body of the request. This will be encrypted over https.
> For this auth type, you do not need to set any authentication header.
33
+
34
+
#### Basic authentication
35
+
Basic authentication uses HTTP Basic Auth, which involves a `username:password` that is base64 encoded and prepended with the string `Basic`.
20
36
21
37
In practice that means taking a Segment source **Write Key**,`'abc123'`, as the username, adding a colon, and then the password field is left empty. After base64 encoding `'abc123:'` becomes `'YWJjMTIzOg=='`; and this is passed in the authorization header like so: `'Authorization: Basic YWJjMTIzOg=='`.
22
38
@@ -105,7 +121,8 @@ POST https://api.segment.io/v1/identify
105
121
"context": {
106
122
"ip": "24.5.68.47"
107
123
},
108
-
"timestamp": "2012-12-02T00:30:08.276Z"
124
+
"timestamp": "2012-12-02T00:30:08.276Z",
125
+
"writeKey": "YOUR_WRITE_KEY"
109
126
}
110
127
```
111
128
This call is identifying the user by their unique User ID (the one you know them by in your database) and labeling them with `email`, `name`, and `industry` traits.
@@ -145,7 +162,8 @@ POST https://api.segment.io/v1/track
145
162
"context": {
146
163
"ip": "24.5.68.47"
147
164
},
148
-
"timestamp": "2012-12-02T00:30:12.984Z"
165
+
"timestamp": "2012-12-02T00:30:12.984Z",
166
+
"writeKey": "YOUR_WRITE_KEY"
149
167
}
150
168
```
151
169
@@ -178,7 +196,8 @@ POST https://api.segment.io/v1/page
178
196
{
179
197
"userId": "019mr8mf4r",
180
198
"name": "Tracking HTTP API",
181
-
"timestamp": "2012-12-02T00:31:29.738Z"
199
+
"timestamp": "2012-12-02T00:31:29.738Z",
200
+
"writeKey": "YOUR_WRITE_KEY"
182
201
}
183
202
```
184
203
The `page` call has the following fields:
@@ -210,7 +229,8 @@ POST https://api.segment.io/v1/screen
210
229
{
211
230
"userId": "019mr8mf4r",
212
231
"name": "Tracking HTTP API",
213
-
"timestamp": "2012-12-02T00:31:29.738Z"
232
+
"timestamp": "2012-12-02T00:31:29.738Z",
233
+
"writeKey": "YOUR_WRITE_KEY"
214
234
}
215
235
```
216
236
@@ -249,7 +269,8 @@ POST https://api.segment.io/v1/group
249
269
"industry": "Technology",
250
270
"employees": 420
251
271
},
252
-
"timestamp": "2012-12-02T00:31:38.208Z"
272
+
"timestamp": "2012-12-02T00:31:38.208Z",
273
+
"writeKey": "YOUR_WRITE_KEY"
253
274
}
254
275
```
255
276
The `group` call has the following fields:
@@ -282,7 +303,8 @@ POST https://api.segment.io/v1/alias
282
303
{
283
304
"previousId": "39239-239239-239239-23923",
284
305
"userId": "019mr8mf4r",
285
-
"timestamp": "2012-12-02T00:31:29.738Z"
306
+
"timestamp": "2012-12-02T00:31:29.738Z",
307
+
"writeKey": "YOUR_WRITE_KEY"
286
308
}
287
309
```
288
310
The `alias` call has the following fields:
@@ -365,6 +387,7 @@ POST https://api.segment.io/v1/batch
365
387
"timestamp": "2015-2-02T00:30:12.984Z"
366
388
}
367
389
],
390
+
"writeKey": "YOUR_WRITE_KEY",
368
391
"context": {
369
392
"device": {
370
393
"type": "phone",
@@ -422,7 +445,8 @@ POST https://api.segment.io/v1/identify
0 commit comments