Skip to main content
GET
/
boxes
/
{boxId}
/
media
/
albums
/
{albumName}
/
media
/
{mediaName}
JavaScript
import GboxSDK from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});

async function main() {
  const box = await gboxSDK.create({ type: "android" });

  // prepare: take a screenshot and save to album
  await box.action.screenshot({
    saveToAlbum: true
  })

  const screenshotsAlbum = await box.media.getAlbum("Screenshots");

  const targetMediaName = (await screenshotsAlbum.listMedia())[0].data.name;

  
  // example: get media info
  const mediaInfo = await screenshotsAlbum.getMediaInfo(targetMediaName);

  console.info(`media info: ${JSON.stringify(mediaInfo, null, 2)}`);


  // example: download media
  const media = await screenshotsAlbum.getMedia(targetMediaName);

  await media.download(`./my-screenshot.png`);

  console.info(`media downloaded to ./my-screenshot.png`);

}

main();
import os
import json
from gbox_sdk import GboxSDK

def main():
# Initialize GboxSDK with API key from environment variable
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])

# Create an Android box for media operations
box = gbox_sdk.create(type="android")

# prepare: take a screenshot and save to album
box.action.screenshot(save_to_album=True)

screenshots_album = box.media.get_album("Screenshots")

target_media_name = screenshots_album.list_media()[0].data.name

# example: get media info
media_info = screenshots_album.get_media_info(target_media_name)

print(f"media info: {media_info}")

# example: download media
media = screenshots_album.get_media(target_media_name)

media.download("./my-screenshot.png")

print("media downloaded to ./my-screenshot.png")

if __name__ == "__main__":
main()
curl --request GET \
--url https://gbox.ai/api/v1/boxes/{boxId}/media/albums/{albumName}/media/{mediaName} \
--header 'Authorization: Bearer <token>'
{
  "type": "photo",
  "mimeType": "image/jpeg",
  "name": "IMG_001.jpg",
  "path": "/sdcard/albums/vacation/IMG_001.jpg",
  "size": "2.5MB",
  "lastModified": "2021-01-01T00:00:00Z"
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer . Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

albumName
string
required

Album name

Example:

"Pictures"

mediaName
string
required

Media name

Example:

"IMG_001.jpg"

Response

200 - application/json

Media detail

Photo representation

type
enum<string>
required

Photo type indicator

Available options:
photo
mimeType
string
required

MIME type of the photo

Example:

"image/jpeg"

name
string
required

Name of the photo

Example:

"IMG_001.jpg"

path
string
required

Full path to the photo in the box

Example:

"/sdcard/albums/vacation/IMG_001.jpg"

size
string
required

Size of the photo

Example:

"2.5MB"

lastModified
string<date-time>
required

Last modified time of the photo

Example:

"2021-01-01T00:00:00Z"