Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Storage containers

Describes how to work with BLOB storage containers available in Optimizely Digital Experience Platform (DXP) environments via the REST API.

Storage accounts are provisioned as part of a DXP project and are used for various purposes (for example, access logs or to download site contents). The storage container API allows access to the BLOB storage containers and contents. The API has the following operations.

  • List – Lists the available BLOB storage containers.
  • Generate SAS link – Generates a read-only or read-write SAS link for a blob container with a dynamic link expiration time.
  • Edge logs location - Generates a read-only SAS link for the edge logs location.

The storage containers API uses an authentication mechanism similar to other deployment APIs. See Deployment API authentication.

Get containers list

Request

GET api/v1.0/projects/{projectId:guid}/environments/{environment}/storagecontainers

Parameters

NameTypeDescription
projectIdGuidThe identifier of the project.
environmentstringThe name of the environment for which the BLOB storage containers will be listed.
writableBooleanList out containers that can be written to. Only available for Integration and Additional environments

Response

{
  "success": bool,
  "errors": array,
  "result": {
    "projectId": guid,
    "environment": string,
    "storageContainers": array
  }
}

Generate SAS link

Request

POST api/v1.0/projects/{projectId:guid}/environments/{environment}/storagecontainers/{containerName}/saslink

Parameters

NameTypeDescription
projectIdGuidThe identifier of the project.
environmentstringThe name of the environment for which the BLOB storage containers will be listed.
containerNamestringName of the container for which a SAS link is to be generated.
writableBooleanGenerate a SAS link that has write permission. Only available for Integration and Additional environments

Body

{
  retentionHours : 12             
}
NameTypeDescription
retentionHoursintTotal hours until the SAS link is valid to access, after which it will expire.

The default value is 24 if no body is included with the POST request.

Response

{
  "success": bool,
  "errors": array,
  "result": {
    "projectId": guid,
    "environment": string,
    "containerName": string,
    "sasLink": string,
    "expiresOn": datetime
  }
}

Get edge logs location

Request

GET /api/v1.0/projects/{projectId}/edgelogs/location

Parameters

NameTypeDescription
projectIdGuidThe identifier of the project.

Response

{
  "application/json": {
    "success": true,
    "errors": [],
    "result": {
      "location": "https://episite.blob.core.windows.net/location"
    }
  }
}

Epicloud Module

The EpiCloud PowerShell module adds the Get-EpiStorageContainer and Get-EpiStorageContainerSasLink and Get-EpiEdgeLogLocation cmdlets to perform the storage containers API operations using PowerShell. To install and connect the module to the authentication mechanism, see Deploy using PowerShell for information about installing the EpiCloud module.

Get-EpiStorageContainer

Fetches the list of BLOB storage containers for an environment in the project. Use the -Writable switch to list out writable containers. It is only available for integration and additional environments.

# Fetchs all read-only and writable containers
Get-EpiStorageContainer -ProjectId "76443fa4-ad6a-4517-a382-ac5900a18fa4" -Environment "Production"

projectId                            environment storageContainers
---------                            ----------- -----------------
76443fa4-ad6a-4517-a382-ac5900a18fa4 Production {azure-application-logs, azure-web-logs, mysitemedia}

# Fetchs writable containers
Get-EpiStorageContainer -ProjectId "76443fa4-ad6a-4517-a382-ac5900a18fa4" -Environment "Integration" -Writable

projectId                            environment storageContainers
---------                            ----------- -----------------
76443fa4-ad6a-4517-a382-ac5900a18fa4 Integration {mysitemedia}

Get-EpiStorageContainerSasLink

Generates a read-only or read-write SAS link for a specific BLOB storage container. The parameter -RetentionHours takes a dynamic value for the SAS link expiry; if not provided, it uses a default of 24 hours to generate the link. The -Writable switch generates read-write SAS links and is only available for integration and additional environments. The -Writable switch cannot be applied to read-only containers.

Get-EpiStorageContainerSasLink -ProjectId "2372b396-6fd2-40ca-a955-57871fc497c9" `
  -Environment "Preproduction" `
  -StorageContainer "azure-web-logs" `
  -RetentionHours 2

projectId     : 76443fa4-ad6a-4517-a382-ac5900a18fa4
environment   : Preproduction
containerName : azure-web-logs
sasLink       : https://storagecontainer.blob.core.windows.net/azure-web-logs
expiresOn     : 20/10/2020 10:13:28

# Generate a writable SAS link to mysitemedia container
Get-EpiStorageContainerSasLink -ProjectId "2372b396-6fd2-40ca-a955-57871fc497c9" `
  -Environment "Integration" `
  -StorageContainer "mysitemedia" `
  -RetentionHours 2 `
  -Writable

projectId     : 76443fa4-ad6a-4517-a382-ac5900a18fa4
environment   : Integration
containerName : mysitemedia
sasLink       : https://storagecontainer.blob.core.windows.net/mysitemedia
expiresOn     : 20/10/2020 10:13:28

Get-EpiEdgeLogLocation

Generates a read-only SAS link for the edge logs location of the project. The SAS link uses the default 24 hours to expiry.

# Fetchs edge logs location based on projectId
Get-EpiEdgeLogLocation -ProjectId "ac138482-0a55-420a-ab4a-b1a700206a64"

https://sitrcmsli879s2af.blob.core.windows.net/cloudflarelogpush?sv=2023-01-03&st=2024-07-09T06:21:45Z
&se=2024-07-10T06:26:45Z&sr=c&sp=rl&sig=r2NBPDR%2FTTEta4ggqLVGDOKayY
updLIFfgjXdpsKn%2FA%3D