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"
}Media
Get media detail
Get detailed information about a specific media file
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
Enter your API Key in the format: Bearer . Get it from https://gbox.ai
Path Parameters
Box ID
Example:
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Album name
Example:
"Pictures"
Media name
Example:
"IMG_001.jpg"
Response
200 - application/json
Media detail
- Photo
- Video
Photo representation
Photo type indicator
Available options:
photo MIME type of the photo
Example:
"image/jpeg"
Name of the photo
Example:
"IMG_001.jpg"
Full path to the photo in the box
Example:
"/sdcard/albums/vacation/IMG_001.jpg"
Size of the photo
Example:
"2.5MB"
Last modified time of the photo
Example:
"2021-01-01T00:00:00Z"
Was this page helpful?