Box Service Account Using REST API
Creating a Connection Scoped to Access All Users (enterprise_id)
Use the Enterprise ID to list content for all users on your connection root. Box Service Account connections require Administrator privileges to use the impersonation feature. Co-administrators do not have the required permissions to perform impersonation.
POST {{url}}v1/connections/
{
"name": "Box Service Account (Access All Users)",
"platform":{
"id":"box-service"
},
"auth":{
"private_key":"-----BEGIN ENCRYPTED PRIVATE KEY-----\#########----END ENCRYPTED PRIVATE KEY-----\n",
"password":"{{passphrase}}",
"client_id":"{{clientID}}",
"client_secret":"{{clientSecret}}",
"public_key_id":"{{publicKeyID}}",
"enterprise_id": "{{enterpriseID}},"
"delete_behavior": "permanent"
}
}
Â
Creating a Connection Using Single Account Impersonation (user_id)
Use the user_id to impersonate a single account.
POST {{url}}v1/connections/
{
"name": "Box Service Account (UserName)",
"platform":{
"id":"box-service"
},
"auth":{
"private_key":"-----BEGIN ENCRYPTED PRIVATE KEY-----\#########----END ENCRYPTED PRIVATE KEY-----\n",
"password":"{{passphrase}}",
"client_id":"{{clientID}}",
"client_secret":"{{clientSecret}}",
"public_key_id":"{{publicKeyID}}",
"user_id": "{{userID}},"
"delete_behavior": "permanent"
}
}
Â
Creating a Job
The path should include impersonation. Box Service Account connections require Administrator privileges to use the impersonation feature. Co-administrators do not have the required permissions to perform impersonation.
{
"name":"Simple Job",
"kind": "transfer",
"transfer": {
"transfer_type": "copy",
"source": {
"connection": { "id": "{{BoxServiceAccount_connection_sourceID}}" },
"impersonate_as": { "email": "user@company.com" },
"target": {
"path": "/sourceFolder"
}
},
"destination": {
"connection": { "id": "{{OneDriveForBusiness_connection_destinationID}}" },
"target": {
"path": "/Documents/destinationFolder"
}
},
"simulation_mode": false
},
"schedule": {
"mode": "manual"
},
"stop_policy": {
"on_success": 5,
"on_failure": 5,
"on_execute": 25
},
"category": {
"name": "Report {Name}"
}
}