Skip to content

Commit 006915e

Browse files
hellcpSorixelle
authored andcommitted
Update the timeline APIs for Rebble
Signed-off-by: Stasia Michalska <[email protected]>
1 parent 2c0e6df commit 006915e

File tree

2 files changed

+26
-40
lines changed

2 files changed

+26
-40
lines changed

source/_guides/pebble-timeline/timeline-js.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ APIs, you will receive an error similar to the following message:
5555
[INFO ] No token available for this app and user.
5656
```
5757

58+
### Shared Pins
59+
60+
For best compatibility with applications, when using shared pins, it is
61+
recommended to define the following in your PebbleKit JS code:
62+
63+
```js
64+
var getTimelineSubscribeToTopicURL = function(topic) {
65+
var encodedTopic = encodeURIComponent(topic);
66+
return "https://timeline-api.rebble.io/v1/user/subscriptions/" + encodedTopic;
67+
};
68+
69+
var getTimelineSubscriptionsListURL = function() {
70+
return "https://timeline-api.rebble.io/v1/user/subscriptions";
71+
};
72+
```
73+
5874

5975
## Get a Timeline Token
6076

source/_guides/pebble-timeline/timeline-public.md

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ every 30 seconds.
4646
Developers can push data to the timeline using their own backend servers. Pins
4747
are created and updated using HTTPS requests to the Pebble timeline web API.
4848

49-
> Pins pushed to the Pebble timeline web API may take **up to** 15 minutes to
49+
> Pins pushed to the Pebble timeline web API may take **up to** 30 minutes to
5050
> appear on a user's watch. Although most pins can arrive faster than this, we
5151
> recommend developers do not design apps that rely on near-realtime updating of
5252
> pins.
@@ -58,7 +58,7 @@ To create a pin, send a `PUT` request to the following URL scheme, where `ID` is
5858
the `id` of the pin object. For example 'reservation-1395203':
5959

6060
```text
61-
PUT https://timeline-api.getpebble.com/v1/user/pins/ID
61+
PUT https://timeline-api.rebble.io/v1/user/pins/ID
6262
```
6363

6464
Use the following headers, where `X-User-Token` is the user's
@@ -90,7 +90,7 @@ sample of an object is shown below:
9090
#### Curl Example
9191

9292
```bash
93-
$ curl -X PUT https://timeline-api.getpebble.com/v1/user/pins/reservation-1395203 \
93+
$ curl -X PUT https://timeline-api.rebble.io/v1/user/pins/reservation-1395203 \
9494
--header "Content-Type: application/json" \
9595
--header "X-User-Token: a70b23d3820e9ee640aeb590fdf03a56" \
9696
-d @pin.json
@@ -104,7 +104,7 @@ To update a pin, send a `PUT` request with a new JSON object with the **same
104104
`id`**.
105105

106106
```text
107-
PUT https://timeline-api.getpebble.com/v1/user/pins/reservation-1395203
107+
PUT https://timeline-api.rebble.io/v1/user/pins/reservation-1395203
108108
109109
```
110110

@@ -134,7 +134,7 @@ included. The example below shows an event updated with a new `time`:
134134
#### Curl Example
135135

136136
```bash
137-
$ curl -X PUT https://timeline-api.getpebble.com/v1/user/pins/reservation-1395203 \
137+
$ curl -X PUT https://timeline-api.rebble.io/v1/user/pins/reservation-1395203 \
138138
--header "Content-Type: application/json" \
139139
--header "X-User-Token: a70b23d3820e9ee640aeb590fdf03a56" \
140140
-d @pin.json
@@ -147,7 +147,7 @@ OK
147147
Delete a pin by issuing a HTTP `DELETE` request.
148148

149149
```text
150-
DELETE https://timeline-api.getpebble.com/v1/user/pins/reservation-1395203
150+
DELETE https://timeline-api.rebble.io/v1/user/pins/reservation-1395203
151151
```
152152

153153
Remember to include the user token in the headers.
@@ -164,7 +164,7 @@ event's details so that it can remain visible and useful to the user.
164164
#### Curl Example
165165

166166
```bash
167-
$ curl -X DELETE https://timeline-api.getpebble.com/v1/user/pins/reservation-1395203 \
167+
$ curl -X DELETE https://timeline-api.rebble.io/v1/user/pins/reservation-1395203 \
168168
--header "Content-Type: application/json" \
169169
--header "X-User-Token: a70b23d3820e9ee640aeb590fdf03a56"
170170
OK
@@ -211,7 +211,7 @@ The pin body remains the same:
211211
#### Curl Example
212212

213213
```bash
214-
$ curl -X PUT https://timeline-api.getpebble.com/v1/shared/pins/giants-game-1 \
214+
$ curl -X PUT https://timeline-api.rebble.io/v1/shared/pins/giants-game-1 \
215215
--header "Content-Type: application/json" \
216216
--header "X-API-Key: fbbd2e4c5a8e1dbef2b00b97bf83bdc9" \
217217
--header "X-Pin-Topics: giants,redsox,baseball" \
@@ -240,7 +240,7 @@ X-API-Key: fbbd2e4c5a8e1dbef2b00b97bf83bdc9
240240
#### Curl Example
241241

242242
```bash
243-
$ curl -X DELETE https://timeline-api.getpebble.com/v1/shared/pins/giants-game-1 \
243+
$ curl -X DELETE https://timeline-api.rebble.io/v1/shared/pins/giants-game-1 \
244244
--header "Content-Type: application/json" \
245245
--header "X-API-Key: fbbd2e4c5a8e1dbef2b00b97bf83bdc9" \
246246
OK
@@ -266,7 +266,7 @@ X-User-Token: a70b23d3820e9ee640aeb590fdf03a56
266266
#### Curl Example
267267

268268
```bash
269-
$ curl -X GET https://timeline-api.getpebble.com/v1/user/subscriptions \
269+
$ curl -X GET https://timeline-api.rebble.io/v1/user/subscriptions \
270270
--header "X-User-Token: a70b23d3820e9ee640aeb590fdf03a56" \
271271
```
272272

@@ -310,33 +310,3 @@ of the following responses.
310310
| 410 | `{ "errorCode": "INVALID_USER_TOKEN" }` | The user token has been invalidated, or does not exist. All further updates with this user token will fail. You should not send further updates for this user token. A user token can become invalidated when a user uninstalls an app for example. |
311311
| 429 | `{ "errorCode": "RATE_LIMIT_EXCEEDED" }` | Server is sending updates too quickly, and has been rate limited (see [*Rate Limiting*](#rate-limiting) below). |
312312
| 503 | `{ "errorCode": "SERVICE_UNAVAILABLE" }` | Could not save pin due to a temporary server error. |
313-
314-
315-
## Rate Limiting
316-
317-
For requests using API Keys, developers can make up to 5000 requests per minute.
318-
For requests using User Tokens, up to 300 requests every 15 minutes can be made.
319-
Check the returned HTTP headers of any API request to see the current rate limit
320-
status:
321-
322-
```text
323-
$ curl -i https://timeline-api.getpebble.com/v1/user/pins/reservation-1395203
324-
325-
HTTP/1.1 429 OK
326-
date: Wed, 13 May 2015 21:36:58 GMT
327-
x-ratelimit-percent: 100
328-
retry-after: 43
329-
```
330-
331-
The headers contain information about the current rate limit status:
332-
333-
| Header Name | Description |
334-
|-------------|-------------|
335-
| `x-ratelimit-percent` | The percentage of the rate limit currently utilized. |
336-
| `retry-after` | When `x-ratelimit-percent` has reached `100`, this header will be set to the number of seconds after which the rate limit will reset. |
337-
338-
When the rate limit is exceeded, the response body also reports the error:
339-
340-
```text
341-
{ "errorCode":"RATE_LIMIT_EXCEEDED" }
342-
```

0 commit comments

Comments
 (0)