-
Notifications
You must be signed in to change notification settings - Fork 130
chore: update general resource access docs #1988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Preview for this PR was built for commit |
Preview for this PR was built for commit |
Preview for this PR was built for commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content-wise looks good, but I'd consider updating the structure to make it easier to read (comments below) and cut bits here and there for brevity.
Preview for this PR was built for commit |
Preview for this PR was built for commit |
I'm aware of the PR, will take a look ~tomorrow 🎗️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a few nits I noticed 👍
|
||
You can create pre-signed URLs either through the Apify Console or programmatically via the Apify API client. | ||
|
||
#### How to generate pre-signed URLs in Apify Console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(general comment)
@raethlo This is essentially... you know... sharing 😄
It's just weird that we have a share modal, and then an export modal, and they both do kind of the same thing. It would totally make sense to somehow integrate it: If you want to share a storage, you should be able to generate a pre-signed link with just content from there.
I have a vague feeling that this has been already brought up somewhere... 🤔
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree completely, we may have talked about it too when I was writing the previous iteration of docs, I think from UX standpoint we should def combine export/sharing.
Preview for this PR was built for commit |
Preview for this PR was built for commit |
Preview for this PR was built for commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few changes requested, generally speaking our style guide calls for bold to be reserved for UI elements, and italics to be used for emphasis
|
||
#### What links can be pre-signed | ||
|
||
Only selected **dataset** and **key-value store** endpoints support pre-signed URLs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only selected **dataset** and **key-value store** endpoints support pre-signed URLs. | |
Only selected _dataset_ and _key-value store_ endpoints support pre-signed URLs. |
| **Datasets** | [Dataset items](/api/v2/dataset-items-get) (`/v2/datasets/:datasetId/items`) | Temporary or Permanent | The link provides access to all dataset items. | | ||
| **Key-value stores** | [List of keys](/api/v2/key-value-store-keys-get) (`/v2/key-value-stores/:storeId/keys`) | Temporary or Permanent | Returns the list of keys in a store. | | ||
| **Key-value stores** | [Single record](/api/v2/key-value-store-record-get) (`/v2/key-value-stores/:storeId/records/:recordKey`) | **Permanent only** | The public URL for a specific record is always permanent - it stays valid as long as the record exists. | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **Datasets** | [Dataset items](/api/v2/dataset-items-get) (`/v2/datasets/:datasetId/items`) | Temporary or Permanent | The link provides access to all dataset items. | | |
| **Key-value stores** | [List of keys](/api/v2/key-value-store-keys-get) (`/v2/key-value-stores/:storeId/keys`) | Temporary or Permanent | Returns the list of keys in a store. | | |
| **Key-value stores** | [Single record](/api/v2/key-value-store-record-get) (`/v2/key-value-stores/:storeId/records/:recordKey`) | **Permanent only** | The public URL for a specific record is always permanent - it stays valid as long as the record exists. | | |
| _Datasets_ | [Dataset items](/api/v2/dataset-items-get) (`/v2/datasets/:datasetId/items`) | Temporary or Permanent | The link provides access to all dataset items. | | |
| _Key-value stores_ | [List of keys](/api/v2/key-value-store-keys-get) (`/v2/key-value-stores/:storeId/keys`) | Temporary or Permanent | Returns the list of keys in a store. | | |
| _Key-value stores_ | [Single record](/api/v2/key-value-store-record-get) (`/v2/key-value-stores/:storeId/records/:recordKey`) | _Permanent only_ | The public URL for a specific record is always permanent - it stays valid as long as the record exists. | | |
- `itemsPublicUrl` – a pre-signed URL providing access to dataset items | ||
- `keysPublicUrl` – a pre-signed URL providing access to key-value store keys | ||
|
||
These automatically generated URLs are **valid for 14 days**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These automatically generated URLs are **valid for 14 days**. | |
These automatically generated URLs are _valid for 14 days_. |
:::note | ||
|
||
To generate a pre-signed link, you can use the **Export** button in Console, or call the appropriate API client method. | ||
The link will include a signature **only if the general resource access is set to Restricted**. For unrestricted datasets, the link will work without a signature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link will include a signature **only if the general resource access is set to Restricted**. For unrestricted datasets, the link will work without a signature. | |
The link will include a signature _only if the general resource access is set to Restricted_. For unrestricted datasets, the link will work without a signature. |
|
||
::: | ||
|
||
**Dataset items:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be H5?
|
||
You can generate pre-signed URLs programmatically for datasets and key-value stores: | ||
|
||
**Dataset items** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be H5?
const permanentItemsUrl = await datasetClient.createItemsPublicUrl(); | ||
``` | ||
|
||
**Key-value store list of keys** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be H5?
const permanentKeysPublicUrl = await storeClient.createKeysPublicUrl(); | ||
``` | ||
|
||
**Key-value store record** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be H5?
|
||
If you need finer control — for example, generating links without using Apify client — you can sign URLs manually using our reference implementation. | ||
|
||
👉 [See reference implementation in Apify clients](https://github.com/apify/apify-client-js/blob/5efd68a3bc78c0173a62775f79425fad78f0e6d1/src/resource_clients/dataset.ts#L179) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to minimize emoji usage
👉 [See reference implementation in Apify clients](https://github.com/apify/apify-client-js/blob/5efd68a3bc78c0173a62775f79425fad78f0e6d1/src/resource_clients/dataset.ts#L179) | |
[Check the reference implementation in Apify clients](https://github.com/apify/apify-client-js/blob/5efd68a3bc78c0173a62775f79425fad78f0e6d1/src/resource_clients/dataset.ts#L179) |
|
||
👉 [See reference implementation in Apify clients](https://github.com/apify/apify-client-js/blob/5efd68a3bc78c0173a62775f79425fad78f0e6d1/src/resource_clients/dataset.ts#L179) | ||
|
||
Manual signing uses standard **HMAC (SHA-256)** with `urlSigningSecretKey` of the resource and can be easily integrated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manual signing uses standard **HMAC (SHA-256)** with `urlSigningSecretKey` of the resource and can be easily integrated. | |
Manual signing uses standard _HMAC (SHA-256)_ with `urlSigningSecretKey` of the resource and can be easily integrated. |
@TC-MO Lint is failing on the files I've never touched. I tried to merge master hoping that it was resolved, but it wasn't. Can you, please, fix it or let me know if I should fix it? |
Preview for this PR was built for commit |
Preview for this PR was built for commit |
Just FYI the files were touched, but that may have been done by the linter? Otherwise neither markdownlint nor vale would touch them as they are set up to only check changed files during PR checks, I'll take a look at what is the issue and fix it in about an hour :) |
This PR updates general resource access documentation, more specifically:
Closes https://github.com/apify/apify-core/issues/23249