Box Storage
Load data from Box Storage.
Configure via UI
We can load data by using two different types of authentication methods:
1. Developer Token Authentication Mechanism
2. Client Credential Grant Authentication Mechanism
Configure via API / Client
1. Developer Token Authentication Mechanism
- Python Client
- TypeScript Client
from llama_cloud.types import CloudBoxDataSource
ds = {
'name': '<your-name>',
'source_type': 'BOX',
'component': CloudBoxDataSource(
folder_id='<folder_id>', # Optional
developer_token='<token>', # Developer Tokens are short lived
)
}
data_source = client.data_sources.create_data_source(request=ds)
const ds = {
'name': '<your-name>',
'sourceType': 'BOX',
'component': {
'folder_id'='<folder_id>', // Optional
'developer_token'='<token>', // Developer Tokens are short lived
}
}
data_source = await client.dataSources.createDataSource({
body: ds
})
2. Client Credential Grant Authentication Mechanism
- Python Client
- TypeScript Client
from llama_cloud.types import CloudBoxDataSource
ds = {
'name': '<your-name>',
'source_type': 'BOX',
'component': CloudBoxDataSource(
folder_id='<folder_id>', # Optional
client_id='<client_id>',
client_secret='<client_secret>',
user_id='<user_id>', # Optional, if using enterprise_id
enterprise_id='<enterprise_id>' # Optional, if using user_id
)
}
data_source = client.data_sources.create_data_source(request=ds)
const ds = {
'name': '<your-name>',
'sourceType': 'BOX',
'component': {
'folder_id'='<folder_id>', // Optional
'client_id'='<client_id>',
'client_secret'='<client_secret>',
'user_id'='<user_id>', // Optional, if using enterprise_id
'enterprise_id'='<enterprise_id>' // Optional, if using user_id
}
}
data_source = await client.dataSources.createDataSource({
body: ds
})
Setting up Box CCG Credentials
- Log in to your Box account / Create a Box developer account and navigate to the developer console.
- Create a new custom app.
- Select "Server Authentication (Client Credentials Grant)" as the authentication method.
- Under "App Access Level", select
App + Enterprise Access
. - Set all permissions for your app.
- Save your changes and submit the app for authorization.
- Open Admin console https://app.box.com/master/custom-apps. As an admin, authorize the app in the Custom Apps Manager.
- Once the app is enabled, get your
User ID
,Enterprise ID
,Client ID
andClient Secret
from app console in developer console.