From a98cd4187fc8bc19a1f00fe3e3effe603c125383 Mon Sep 17 00:00:00 2001 From: "gabriel.alves" Date: Tue, 14 Jul 2026 17:12:50 -0300 Subject: [PATCH] Enhance Object Storage API documentation with interactive exploration links and additional cURL examples --- .../reference/store/object-storage/index.mdx | 97 ++++++++++++++++-- .../referencia/store/edge-storage/index.mdx | 98 +++++++++++++++++-- 2 files changed, 175 insertions(+), 20 deletions(-) diff --git a/src/content/docs/en/pages/main-menu/reference/store/object-storage/index.mdx b/src/content/docs/en/pages/main-menu/reference/store/object-storage/index.mdx index 9e4c600ef9..9fb602d308 100644 --- a/src/content/docs/en/pages/main-menu/reference/store/object-storage/index.mdx +++ b/src/content/docs/en/pages/main-menu/reference/store/object-storage/index.mdx @@ -144,9 +144,11 @@ Our billing model is transparent and focused on actual usage, without penalizing ### Azion API operations :::tip -All the API operations are available in the [Azion API](https://api.azion.com/v4#/operations/GetEdgeStorageBuckets) documentation. +All the API operations are available in the [Azion API](https://api.azion.com/v4#/operations/GetEdgeStorageBuckets) documentation. You can also explore and test them interactively in the API reference. ::: + + | Class | Operation name | HTTP method | |-------|-----------------------|-------------| | A | [ListObjects](#listobjects) | `GET` | @@ -169,54 +171,122 @@ Retrieves a list of objects loaded into a bucket. This operation returns details of all objects in the bucket, including the size in bytes and the timestamp of the last modification. +```bash +curl --request GET \ + --url 'https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects' \ + --header 'Authorization: Token {your-personal-token}' +``` + #### CreateBucket + Creates a new bucket for an account. +```bash +curl --request POST \ + --url https://api.azion.com/v4/workspace/storage/buckets \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' \ + --header 'Content-Type: application/json' \ + --data '{ + "name": "string", + "workloads_access": "read_only" +}' +``` + #### ListBuckets Retrieves a list of buckets associated with an account. +```bash +curl --request GET \ + --url https://api.azion.com/v4/workspace/storage/buckets \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` + #### UpdateBucket Modifies bucket information. Use this operation to change the access permissions to the objects in the bucket. Buckets cannot be renamed with this operation. +```bash +curl --request PATCH \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' \ + --header 'Content-Type: application/json' \ + --data '{ + "workloads_access": "read_only" +}' +``` + #### GetObject Retrieves an object from a bucket. -:::tip -For API cURL requests, add the `-O -J` options to the command to download the object to your device using this operation. -::: + +```bash +curl --request GET \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key} \ + --header 'Accept: application/octet-stream, application/json' \ + --header 'Authorization: Bearer [token]' +``` #### PostObject Uploads an object to a bucket. Objects are limited to a maximum size of 20 MB. -:::tip -For API cURL requests, use the `--data-binary` option in the command to send raw binary data, such as images or complex files without undergoing URL encoding. -::: For the **Azion API**, you can specify the MIME type of the object being sent in the body using the `Content-Type` header. For example, objects with the `.txt` extension should contain the `Content-Type: text/plain` header. If the MIME type isn't specified, **Object Storage** will attempt to interpret the file type based on the file extension. Alternatively, use the `application/octet-stream` MIME type to indicate that the data is a binary stream and the server should handle it as raw binary data. Sending a new object with an object key already in the bucket will replace the previous object. +```bash +curl --request POST \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' \ + --header 'Storage-Content-Type: ' +``` + +To upload a binary file such as an image: + +```bash +curl --request POST \ + --url 'https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/images/photo.jpg' \ + --header 'Authorization: Token {your-personal-token}' \ + --header 'Content-Type: image/jpeg' \ + --data-binary '@/path/to/photo.jpg' +``` + #### PutObject Uploads an object to a bucket. Sending a new object with an object key that already existed in the bucket will replace the previous object. +```bash +curl --request PUT \ + --url 'https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key}' \ + --header 'Authorization: Token {your-personal-token}' \ + --header 'Content-Type: application/octet-stream' \ + --data-binary '@/path/to/local/file' +``` + #### DeleteObject Removes an object from a bucket. When you delete an object being served on the edge, it'll immediately stop being served and will no longer be listed in the bucket. -:::caution[warning] -For S3 credential access, this operation is allowed through the capability `deleteFiles`, which requires the `writeFiles` capability to be enabled. -::: + +```bash +curl --request DELETE \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` #### DeleteBucket @@ -224,6 +294,13 @@ Removes a bucket from an account. Buckets that contain objects cannot be deleted. After removing the final object from a bucket, there is a 24-hour period before the bucket can be deleted. +```bash +curl --request DELETE \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` + ### S3 operations :::note diff --git a/src/content/docs/pt-br/pages/menu-principal/referencia/store/edge-storage/index.mdx b/src/content/docs/pt-br/pages/menu-principal/referencia/store/edge-storage/index.mdx index a60f913f05..8fb578b871 100644 --- a/src/content/docs/pt-br/pages/menu-principal/referencia/store/edge-storage/index.mdx +++ b/src/content/docs/pt-br/pages/menu-principal/referencia/store/edge-storage/index.mdx @@ -149,17 +149,19 @@ Nosso modelo de faturamento é transparente e focado no uso efetivo, sem penaliz ### Operações da API da Azion :::tip -Todas as operações da API estão disponíveis na documentação da [API da Azion](https://api.azion.com/#565230b1-5f75-49e5-b025-0dc9e271883d). +Todas as operações da API estão disponíveis na documentação da [API da Azion](https://api.azion.com/v4#/operations/GetEdgeStorageBuckets). Você também pode explorá-las e testá-las interativamente na referência da API. ::: + + | Classe | Nome da operação | Método HTTP | | --- | --- | --- | | A | [ListObjects](#listobjects) | `GET` | | A | [CreateBucket](#createbucket) | `POST` | -| A | [ListBuckets](#listbuckets) | `GET` | +| A | [ListBuckets](#listbuckets) | `GET` | | A | [UpdateBucket](#updatebucket) | `PATCH` | | B | [GetObject](#getobject) | `GET` | -| C | [PostObject](#postobject) | `POST` | +| C | [PostObject](#postobject) | `POST` | | C | [PutObject](#putobject) | `PUT` | | C | [DeleteObject](#deleteobject) | `DELETE` | | C | [DeleteBucket](#deletebucket) | `DELETE` | @@ -174,46 +176,108 @@ Recupera uma lista de objetos carregados em um bucket. Esta operação retorna detalhes de todos os objetos no bucket, incluindo o tamanho em bytes e o timestamp da última modificação. +```bash +curl --request GET \ + --url 'https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects' \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` + #### CreateBucket Cria um novo bucket para uma conta. +```bash +curl --request POST \ + --url https://api.azion.com/v4/workspace/storage/buckets \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' \ + --header 'Content-Type: application/json' \ + --data '{ + "name": "string", + "workloads_access": "read_only" +}' +``` + #### ListBuckets Recupera uma lista de buckets associados a uma conta. +```bash +curl --request GET \ + --url https://api.azion.com/v4/workspace/storage/buckets \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` + #### UpdateBucket Modifica as informações do bucket. Use esta operação para alterar as permissões de acesso aos objetos no bucket. Buckets não podem ser renomeados com esta operação. +```bash +curl --request PATCH \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' \ + --header 'Content-Type: application/json' \ + --data '{ + "workloads_access": "read_only" +}' +``` + #### GetObject Recupera um objeto de um bucket. -:::tip -Para requisições cURL da API, adicione as opções `-O -J` ao comando para baixar o objeto para o seu dispositivo usando esta operação. -::: +```bash +curl --request GET \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key} \ + --header 'Accept: application/octet-stream, application/json' \ + --header 'Authorization: Bearer [token]' +``` #### PostObject Faz o upload de um objeto para um bucket. Os objetos são limitados a um tamanho máximo de 20 MB. -:::tip -Para requisições cURL da API, use a opção `--data-binary` no comando para enviar dados binários brutos, como imagens ou arquivos complexos, sem passar pela codificação de URL. -::: - Para a **API da Azion**, você pode especificar o tipo MIME do objeto sendo enviado no corpo usando o cabeçalho `Content-Type`. Por exemplo, objetos com a extensão `.txt` devem conter o cabeçalho `Content-Type: text/plain`. Se o tipo MIME não for especificado, **Object Storage** tentará interpretar o tipo de arquivo com base na extensão do arquivo. Alternativamente, use o tipo MIME `application/octet-stream` para indicar que os dados são um fluxo binário e o servidor deve tratá-los como dados binários brutos. Enviar um novo objeto com uma chave de objeto já existente no bucket substituirá o objeto anterior. +```bash +curl --request POST \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' \ + --header 'Storage-Content-Type: ' +``` + +Para fazer upload de um arquivo binário, como uma imagem: + +```bash +curl --request POST \ + --url 'https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/images/photo.jpg' \ + --header 'Authorization: Bearer [token]' \ + --header 'Content-Type: image/jpeg' \ + --data-binary '@/caminho/para/photo.jpg' +``` + #### PutObject Faz o upload de um objeto para um bucket. Enviar um novo objeto com uma chave de objeto que já existia no bucket substituirá o objeto anterior. +```bash +curl --request PUT \ + --url 'https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key}' \ + --header 'Authorization: Bearer [token]' \ + --header 'Content-Type: application/octet-stream' \ + --data-binary '@/caminho/para/arquivo' +``` + #### DeleteObject Remove um objeto de um bucket. @@ -224,12 +288,26 @@ Quando você exclui um objeto que está sendo servido no edge, ele deixará de s Para acesso com credenciais S3, esta operação é permitida através da capacidade `deleteFiles`, que requer que a capacidade `writeFiles` esteja habilitada. ::: +```bash +curl --request DELETE \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name}/objects/{object_key} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` + #### DeleteBucket Remove um bucket de uma conta. Buckets que contêm objetos não podem ser excluídos. Após remover o último objeto de um bucket, há um período de 24 horas antes que o bucket possa ser excluído. +```bash +curl --request DELETE \ + --url https://api.azion.com/v4/workspace/storage/buckets/{bucket_name} \ + --header 'Accept: application/json' \ + --header 'Authorization: Bearer [token]' +``` + ### Operações do protocolo S3 :::note