JavaScript
import GboxSDK from "gbox-sdk";
import fs from "fs";
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" });
// Create a new album with media files
const album = await box.media.createAlbum({
name: "vacation-2024",
media: [
"/path/to/photo1.jpg",
"/path/to/photo2.jpg",
]
});
console.log(`✅ Album created: ${album.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")
# Create a new album with media files
# The media parameter accepts a list of file paths
album = box.media.create_album(
name="vacation-2024",
media=[
"/path/to/photo1.jpg",
"/path/to/photo2.jpg",
]
)
# Print the created album information
print(f"✅ Album created: {album.data.name}")
if __name__ == "__main__":
main()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/media/albums \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Vacation Photos'{
"name": "Vacation Photos",
"path": "/sdcard/albums/vacation",
"lastModified": "2021-01-01T00:00:00Z",
"mediaCount": 15
}Media
Create album
Create a new album with media files
POST
/
boxes
/
{boxId}
/
media
/
albums
JavaScript
import GboxSDK from "gbox-sdk";
import fs from "fs";
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" });
// Create a new album with media files
const album = await box.media.createAlbum({
name: "vacation-2024",
media: [
"/path/to/photo1.jpg",
"/path/to/photo2.jpg",
]
});
console.log(`✅ Album created: ${album.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")
# Create a new album with media files
# The media parameter accepts a list of file paths
album = box.media.create_album(
name="vacation-2024",
media=[
"/path/to/photo1.jpg",
"/path/to/photo2.jpg",
]
)
# Print the created album information
print(f"✅ Album created: {album.data.name}")
if __name__ == "__main__":
main()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/media/albums \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Vacation Photos'{
"name": "Vacation Photos",
"path": "/sdcard/albums/vacation",
"lastModified": "2021-01-01T00:00:00Z",
"mediaCount": 15
}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"
Body
multipart/form-data
Album creation with media files (max size: 512MB per file)
Response
201 - application/json
Album created successfully
Album representation
Name of the album
Example:
"Vacation Photos"
Full path to the album in the box
Example:
"/sdcard/albums/vacation"
Last modified time of the album
Example:
"2021-01-01T00:00:00Z"
Number of media files in the album
Example:
15
Was this page helpful?