Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

List metadata instances on folder

get
https://api.box.com/2.0
/folders/:folder_id/metadata

Retrieves all metadata for a given folder. This can not be used on the root folder with ID 0.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The unique identifier that represent a folder.

The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/folder/123 the folder_id is 123.

The root folder of a Box account is always represented by the ID 0.

Response

application/jsonMetadata instances

Returns all the metadata associated with a folder.

This API does not support pagination and will therefore always return all of the metadata associated to the folder.

application/jsonClient error

Returned when the request parameters are not valid.

  • forbidden - this operation is not allowed on the Root folder.
application/jsonClient error

Returned when the user does not have access to the folder.

application/jsonClient error

An unexpected client error.

get
List metadata instances on folder
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X GET "https://api.box.com/2.0/folders/4353455/metadata" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.folderMetadata.getFolderMetadata(folder.id);
Python Gen
client.folder_metadata.get_folder_metadata(folder.id)
.NET Gen
await client.FolderMetadata.GetFolderMetadataAsync(folderId: folder.Id);
Swift Gen (Beta)
try await client.folderMetadata.getFolderMetadata(folderId: folder.id)
Java
BoxFolder file = new BoxFolder(api, "id");
Iterable<Metadata> metadataList = folder.getAllMetadata();
for (Metadata metadata : metadataList) {
    // Do something with the metadata.
}
Python
folder_metadata = client.folder(folder_id='22222').get_all_metadata()
for instance in folder_metadata:
    if 'foo' in instance:
        print(f'Metadata instance {instance["id"]} has value "{instance["foo"]}" for foo')
.NET
BoxMetadataTemplateCollection<Dictionary<string, object>> metadataInstances = await client.MetadataManager
    .GetAllFolderMetadataTemplatesAsync(folderId: "11111");
Node
client.folders.getAllMetadata('11111')
	.then(metadata => {
		/* metadata -> {
			entries: 
			[ { currentDocumentStage: 'Init',
				'$type': 'documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f',
				'$parent': 'folder_11111',
				'$id': '50ba0dba-0f89-4395-b867-3e057c1f6ed9',
				'$version': 4,
				'$typeVersion': 2,
				needsApprovalFrom: 'Smith',
				'$template': 'documentFlow',
				'$scope': 'enterprise_12345' },
				{ '$type': 'productInfo-9d7b6993-b09e-4e52-b197-e42f0ea995b9',
				'$parent': 'folder_11111',
				'$id': '15d1014a-06c2-47ad-9916-014eab456194',
				'$version': 2,
				'$typeVersion': 1,
				skuNumber: 45334223,
				description: 'Watch',
				'$template': 'productInfo',
				'$scope': 'enterprise_12345' },
				{ Popularity: '25',
				'$type': 'properties',
				'$parent': 'folder_11111',
				'$id': 'b6f36cbc-fc7a-4eda-8889-130f350cc057',
				'$version': 0,
				'$typeVersion': 2,
				'$template': 'properties',
				'$scope': 'global' } ],
			limit: 100 }
		*/
	});
iOS
client.metadata.list(forFolderId: "22222") { (result: Result<[MetadataObject], BoxSDKError>) in
    guard case let .success(metadata) = result {
        print("Error retrieving metadata")
        return
    }

    print("Retrieved \(metadata.count) metadata instances:")
    for instance in metadata {
        print("- \(instance.template)")
    }
}

Response Example

{
  "entries": [
    {
      "$parent": "folder_59449484661,",
      "$template": "marketingCollateral",
      "$scope": "enterprise_27335",
      "$version": 1
    }
  ],
  "limit": 100
}