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" });
console.info("taking screenshot and saving to album...");
await box.action.screenshot({
saveToAlbum: true
})
const album = await box.media.getAlbum("Screenshots");
console.info("listing media info...");
const mediaInfo = await album.listMediaInfo();
console.info(`media info: ${JSON.stringify(mediaInfo, null, 2)}`);
const media = await album.listMedia();
console.info("downloading media...");
for (const item of media) {
await item.download(`./${item.data.name}`);
}
}
main();import os
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")
print("taking screenshot and saving to album...")
# Take screenshot and save to album
box.action.screenshot(save_to_album=True)
# Get the Screenshots album
album = box.media.get_album("Screenshots")
print("listing media info...")
# Get media information
media_info = album.list_media_info()
print(f"media info: {media_info}")
# Get media list
media = album.list_media()
print("downloading media...")
# Download each media file
for item in media:
item.download(f"./{item.data.name}")
if __name__ == "__main__":
main()curl --request GET \
--url https://gbox.ai/api/v1/boxes/{boxId}/media/albums/{albumName}/media \
--header 'Authorization: Bearer <token>'{
"data": [
{
"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
List media in album
Get a list of media files in a specific album
GET
/
boxes
/
{boxId}
/
media
/
albums
/
{albumName}
/
media
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" });
console.info("taking screenshot and saving to album...");
await box.action.screenshot({
saveToAlbum: true
})
const album = await box.media.getAlbum("Screenshots");
console.info("listing media info...");
const mediaInfo = await album.listMediaInfo();
console.info(`media info: ${JSON.stringify(mediaInfo, null, 2)}`);
const media = await album.listMedia();
console.info("downloading media...");
for (const item of media) {
await item.download(`./${item.data.name}`);
}
}
main();import os
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")
print("taking screenshot and saving to album...")
# Take screenshot and save to album
box.action.screenshot(save_to_album=True)
# Get the Screenshots album
album = box.media.get_album("Screenshots")
print("listing media info...")
# Get media information
media_info = album.list_media_info()
print(f"media info: {media_info}")
# Get media list
media = album.list_media()
print("downloading media...")
# Download each media file
for item in media:
item.download(f"./{item.data.name}")
if __name__ == "__main__":
main()curl --request GET \
--url https://gbox.ai/api/v1/boxes/{boxId}/media/albums/{albumName}/media \
--header 'Authorization: Bearer <token>'{
"data": [
{
"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"
Response
200 - application/json
List of media files
List album media
List of media files (photos and videos) in the album
Photo representation
- Photo
- Video
Show child attributes
Show child attributes
Was this page helpful?
⌘I