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();
{
  "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 <token>. 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"