Skip to content

Commit 0d9e9f8

Browse files
authored
Merge pull request #11 from glideapps/api-update-glide-pr-29066
2 parents bb29424 + b875cb3 commit 0d9e9f8

File tree

9 files changed

+67
-119
lines changed

9 files changed

+67
-119
lines changed

api-reference/v2/general/errors.mdx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ All error responses will follow the following format with a top-level `error` ob
1616
}
1717
```
1818

19-
## Invalid Auth Token
19+
### Invalid Auth Token
2020

2121
Using an auth token that does not exist or is incorrect will result in a `404` response status.
2222

@@ -33,4 +33,23 @@ curl --request GET \
3333
"message": "API key not found, or duplicate IN****ID"
3434
}
3535
}
36-
```
36+
```
37+
38+
### Invalid Stash ID or Serial
39+
40+
Using a stash ID or serial that does not [meet the requirements](../stashing/introduction#stash-ids-and-serials) will result in a `400` response status.
41+
42+
```bash
43+
curl --request PUT \
44+
--url https://api.glideapps.com/stashes/-INVALID-/1 \
45+
--header 'Authorization: Bearer VALID-API-KEY'
46+
```
47+
48+
```json
49+
{
50+
"error": {
51+
"type": "request_validation_error",
52+
"message": "Invalid request params: Stash ID must be 256 characters max, alphanumeric with dashes and underscores, no leading dash or underscore"
53+
}
54+
}
55+
```

api-reference/v2/resources/changelog.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
---
12
title: Glide API Changelog
23
sidebarTitle: Changelog
34
---
45

6+
### August 28, 2024
7+
8+
- Users should now use the PUT method instead of POST for `/stashes/{stashID}/{serial}` to set the content of a chunk in a stash.
9+
- Clarified that if a chunk is uploaded with an existing serial, its data will be overwritten.
10+
- Documented the new format requirements for `stashID` and `serial`.
11+
512
### August 23, 2024
613

714
- The `POST /tables` endpoint now returns HTTP status 201 on success instead of 200.

api-reference/v2/stashing/delete-stash.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ title: Delete Stash
33
openapi: delete /stashes/{stashID}
44
---
55

6-
If you no longer need a stash, you can delete it. This will remove the stash and all the data it contains. Stashes are automatically deleted within 48 hours of creation.
6+
If you no longer need a stash, you can delete it. This will remove the stash and all the data it contains.
7+
8+
<Note>Even if you do not call this endpoint, all stashes are automatically deleted within 48 hours after they are created.</Note>
79

810
<Tip>
911
To understand what stashing is and how to use it to work with large datasets, please see our [introduction to stashing](/api-reference/v2/stashing/introduction).

api-reference/v2/stashing/introduction.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@ title: Introduction
33
description: Stashing large datasets for use with the Glide API
44
---
55

6-
When working with large datasets it is necessary to break it into smaller chunks for performance and reliability. We call this process "stashing".
6+
When using large datasets with the Glide API, it may be necessary to break them into smaller chunks for performance and reliability. We call this process "stashing."
77

88
## What is Stashing?
99

10-
Stashing is the process by which a large dataset is broken into smaller subsets for uploading to Glide. Each subset is uploaded to Glide independently (either sequentially or in parallel) to form the complete dataset.
10+
Stashing is the process by which a large dataset is broken into smaller chunks for uploading to Glide. Each chunk is uploaded to Glide independently (either sequentially or in parallel) to form the complete dataset.
1111

1212
Once all data has been uploaded to the stash, the stash can then be referenced in other API calls to refer to the full dataset. This eliminates the need to include the entire dataset in the request itself, which may not be feasible due to its size.
1313

1414
## When to Use Stashing
1515

1616
You should use stashing when:
1717

18-
* You have a large dataset that you want to upload to Glide. Anything larger than 5mb should be broken up into smaller subsets and stashed.
18+
* You have a large dataset that you want to upload to Glide. Anything larger than 5mb should be broken up into smaller chunks and stashed.
1919
* You want to perform an atomic operation using a large dataset. For example, you may want to perform an import of data into an existing table but don't want users to see the intermediate state of the import or incremental updates while they're using their application.
2020

21-
## Core Concepts
21+
## Stash IDs and Serials
2222

23-
The main components of a stash are its ID and the individual chunked data subsets which are identified by a serial. Both the id and serial are values you define.
23+
The main components of a stash are its ID and the individual chunked data subsets, which are identified by serials. Both the ID and serial are values you define.
2424

25-
The stash ID is a unique identifier for the stash that you define from the relevant information of your domain. This is often a combination of temporal information and a domain identifier. For instance: `20240215-job32` or `2024-07-05T15:17:50Z-customer93ak`.
25+
The **stash ID** is a unique identifier for the stash that you define. You might use information that's relevant to your domain, such as `20240215-job32` or `2024-07-05T15-17-50Z_customer93ak`, a UUID, or any other unique identifier.
2626

27-
Each subset of data that is uploaded to the stash is identified by a serial. If the order of each data subset is important to the overall datset, you should use the serial to represent the order of loading (e.g., `1`, `2`, etc...).
27+
Each chunk of data that is uploaded to the stash is identified by a unique **serial**. The sort order of the serials indicates the order of the chunks in the overall datset. If all serials can be parsed as integers, numerical sort order is used, otherwise sorting is done lexicographically according to each character's Unicode code point value. If the order of data chunks in the stash is important, using integers as serials (e.g., `1`, `2`, etc...) is recommended.
2828

29-
If the order of each data subset is not important, then you can use a random serial for each subset like a UUID: `123e4567-e89b-12d3-a456-426655440000`. The only requirement is that the serial must be unique for each subset.
29+
<Note>The maximum length for both stash IDs and serials is 256 characters. They may only contain letters, numbers, hyphens, and underscores, and must start with a letter or number.</Note>
3030

3131
## Referencing a Stash
3232

33-
Once a stash, and all its parts, has been uploaded you can use the stash ID in other API calls to refer to the full dataset instead of including the entire dataset itself. Think of it as a reference to all the data in the stash.
33+
Once all chunks have been uploaded to a stash, you can use the stash ID in place of passing the full dataset inline to other Glide API calls. Think of it as a reference to all the data in the stash.
3434

3535
For instance, instead of including all the row data in a request to create a table, you can instead reference the stash ID:
3636

api-reference/v2/stashing/post-stashes-serial.mdx

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Stash Data
3+
openapi: put /stashes/{stashID}/{serial}
4+
---
5+
6+
When using large datasets with the Glide API, it may be necessary to break them into smaller chunks for performance and reliability. We call this process "stashing."
7+
8+
<Tip>
9+
To learn more about stashing and how to use it to work with large datasets, please see our [introduction to stashing](/api-reference/v2/stashing/introduction).
10+
</Tip>

api-reference/v2/tutorials/bulk-import.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ To simplify the coordination, parallelization, and idempotency of the upload pro
3232

3333
For instance, a daily import process might have a stash ID of `20240501-import`. Or, an import specific to a single customer might have a stash ID of `customer-381-import`.
3434

35-
<Warning>
36-
The stashID must be in the format of a UUID, e.g., `"123e4567-e89b-12d3-a456-426655440000"`. This is a known issue and will be fixed in a future release.
37-
</Warning>
38-
3935
You are responsible for ensuring that the stash ID is unique and stable across associated uploads.
4036

4137
## Upload Data

mint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"group": "Stashing",
4444
"pages": [
4545
"api-reference/v2/stashing/introduction",
46-
"api-reference/v2/stashing/post-stashes-serial",
46+
"api-reference/v2/stashing/put-stashes-serial",
4747
"api-reference/v2/stashing/delete-stash"
4848
]
4949
},

openapi/swagger.json

Lines changed: 16 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@
367367
"properties": {
368368
"$stashID": {
369369
"type": "string",
370-
"description": "ID of the stash whose data should be used",
370+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$",
371+
"description": "ID of the stash, e.g., `20240215-job32`",
371372
"example": "20240215-job32"
372373
}
373374
},
@@ -695,7 +696,8 @@
695696
"properties": {
696697
"$stashID": {
697698
"type": "string",
698-
"description": "ID of the stash whose data should be used",
699+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$",
700+
"description": "ID of the stash, e.g., `20240215-job32`",
699701
"example": "20240215-job32"
700702
}
701703
},
@@ -924,7 +926,8 @@
924926
"properties": {
925927
"$stashID": {
926928
"type": "string",
927-
"description": "ID of the stash whose data should be used",
929+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$",
930+
"description": "ID of the stash, e.g., `20240215-job32`",
928931
"example": "20240215-job32"
929932
}
930933
},
@@ -941,87 +944,8 @@
941944
}
942945
}
943946
},
944-
"/stashes": {
945-
"post": {
946-
"responses": {
947-
"200": {
948-
"description": "",
949-
"content": {
950-
"application/json": {
951-
"schema": {
952-
"type": "object",
953-
"properties": {
954-
"data": {
955-
"type": "object",
956-
"properties": {
957-
"stashID": {
958-
"type": "string",
959-
"description": "The newly created stash"
960-
}
961-
},
962-
"required": [
963-
"stashID"
964-
],
965-
"additionalProperties": false
966-
}
967-
},
968-
"required": [
969-
"data"
970-
],
971-
"additionalProperties": false
972-
}
973-
}
974-
}
975-
},
976-
"400": {
977-
"description": "",
978-
"content": {
979-
"application/json": {
980-
"schema": {
981-
"type": "object",
982-
"properties": {
983-
"error": {
984-
"type": "object",
985-
"properties": {
986-
"type": {
987-
"type": "string"
988-
},
989-
"message": {
990-
"type": "string"
991-
}
992-
},
993-
"required": [
994-
"type",
995-
"message"
996-
],
997-
"additionalProperties": false
998-
}
999-
},
1000-
"required": [
1001-
"error"
1002-
],
1003-
"additionalProperties": false
1004-
}
1005-
}
1006-
}
1007-
}
1008-
},
1009-
"operationId": "Create stash",
1010-
"requestBody": {
1011-
"content": {
1012-
"application/json": {
1013-
"schema": {
1014-
"type": "object",
1015-
"properties": {},
1016-
"additionalProperties": false
1017-
}
1018-
}
1019-
}
1020-
}
1021-
}
1022-
},
1023947
"/stashes/{stashID}/{serial}": {
1024-
"post": {
948+
"put": {
1025949
"responses": {
1026950
"200": {
1027951
"description": "",
@@ -1069,14 +993,15 @@
1069993
}
1070994
}
1071995
},
1072-
"description": "Adds data to a stash",
996+
"description": "Sets the content of a chunk of data inside a stash",
1073997
"parameters": [
1074998
{
1075999
"name": "stashID",
10761000
"in": "path",
10771001
"schema": {
10781002
"type": "string",
1079-
"description": "ID of the stash to add data to, e.g., `20240215-job32`",
1003+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$",
1004+
"description": "ID of the stash. The stash will be created if it doesn't already exist.",
10801005
"example": "20240215-job32"
10811006
},
10821007
"required": true
@@ -1086,7 +1011,9 @@
10861011
"in": "path",
10871012
"schema": {
10881013
"type": "string",
1089-
"description": "Serial identifier of the chunk of data to add to the stash. Chunks will be assembled in the sort order of their serials, so utilize ordered identifiers for each chunk if a specific ordering of data is required, e.g., `1`, `2`, etc...\nIf the order of data is not important, random, but unique, values can be used, e.g., `c2a4567`."
1014+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$",
1015+
"description": "Serial identifier of the chunk of data to set in the stash. If a chunk has already been sent with the same serial, its data will be overwritten. Chunks will be assembled in the sort order of their serials, so utilize ordered identifiers for each chunk if a specific ordering of data in the stash is desired, e.g., `1`, `2`, etc...\nIf the order of data is not important, random, but unique, values can be used, e.g., `c2a4567`.",
1016+
"example": "1"
10901017
},
10911018
"required": true
10921019
}
@@ -1170,14 +1097,15 @@
11701097
}
11711098
}
11721099
},
1173-
"description": "Deletes a stash and its data",
1100+
"description": "Deletes a stash and all its data",
11741101
"parameters": [
11751102
{
11761103
"name": "stashID",
11771104
"in": "path",
11781105
"schema": {
11791106
"type": "string",
1180-
"description": "ID of the stash to delete, e.g., `20240215-job32`",
1107+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$",
1108+
"description": "ID of the stash, e.g., `20240215-job32`",
11811109
"example": "20240215-job32"
11821110
},
11831111
"required": true

0 commit comments

Comments
 (0)