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
+18-16Lines changed: 18 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,11 @@ 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) 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`.
20
-
21
-
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
-
23
-
> info ""
24
-
> Include a colon before encoding. While encoding the write key without a colon might work due to backward compatibility, this won't always be the case.
18
+
The authentication writeKey should be snet as part of the body of the request. This will be encrypted over https.
25
19
26
20
#### OAuth
27
21
[Obtain the access token](/docs/connections/oauth/) from the Authorization Server specific to the region.
@@ -105,7 +99,8 @@ POST https://api.segment.io/v1/identify
105
99
"context": {
106
100
"ip": "24.5.68.47"
107
101
},
108
-
"timestamp": "2012-12-02T00:30:08.276Z"
102
+
"timestamp": "2012-12-02T00:30:08.276Z",
103
+
"writeKey": "123xyz"
109
104
}
110
105
```
111
106
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 +140,8 @@ POST https://api.segment.io/v1/track
145
140
"context": {
146
141
"ip": "24.5.68.47"
147
142
},
148
-
"timestamp": "2012-12-02T00:30:12.984Z"
143
+
"timestamp": "2012-12-02T00:30:12.984Z",
144
+
"writeKey": "123xyz"
149
145
}
150
146
```
151
147
@@ -178,7 +174,8 @@ POST https://api.segment.io/v1/page
178
174
{
179
175
"userId": "019mr8mf4r",
180
176
"name": "Tracking HTTP API",
181
-
"timestamp": "2012-12-02T00:31:29.738Z"
177
+
"timestamp": "2012-12-02T00:31:29.738Z",
178
+
"writeKey": "123xyz"
182
179
}
183
180
```
184
181
The `page` call has the following fields:
@@ -210,7 +207,8 @@ POST https://api.segment.io/v1/screen
210
207
{
211
208
"userId": "019mr8mf4r",
212
209
"name": "Tracking HTTP API",
213
-
"timestamp": "2012-12-02T00:31:29.738Z"
210
+
"timestamp": "2012-12-02T00:31:29.738Z",
211
+
"writeKey": "123xyz"
214
212
}
215
213
```
216
214
@@ -249,7 +247,8 @@ POST https://api.segment.io/v1/group
249
247
"industry": "Technology",
250
248
"employees": 420
251
249
},
252
-
"timestamp": "2012-12-02T00:31:38.208Z"
250
+
"timestamp": "2012-12-02T00:31:38.208Z",
251
+
"writeKey": "123xyz"
253
252
}
254
253
```
255
254
The `group` call has the following fields:
@@ -282,7 +281,8 @@ POST https://api.segment.io/v1/alias
282
281
{
283
282
"previousId": "39239-239239-239239-23923",
284
283
"userId": "019mr8mf4r",
285
-
"timestamp": "2012-12-02T00:31:29.738Z"
284
+
"timestamp": "2012-12-02T00:31:29.738Z",
285
+
"writeKey": "123xyz"
286
286
}
287
287
```
288
288
The `alias` call has the following fields:
@@ -365,6 +365,7 @@ POST https://api.segment.io/v1/batch
365
365
"timestamp": "2015-2-02T00:30:12.984Z"
366
366
}
367
367
],
368
+
"writeKey": "123xyz",
368
369
"context": {
369
370
"device": {
370
371
"type": "phone",
@@ -422,7 +423,8 @@ POST https://api.segment.io/v1/identify
0 commit comments