Details
| ID | Box |
|---|---|
| Provider | Box |
| Category | IT Services |
| From Version | 5.0.0 |
| Supported Modules | Agentix XSIAM |
README
Deprecated. Use the Box v2 integration instead.
Configure Box in Cortex
| Parameter | Description | Required |
|---|---|---|
| insecure | Trust any certificate (not secure) | False |
How to initialize the Box integration
Note: The following steps should be done in less than 30 seconds due to Box security.
- Create a new Box instance. Do not click Test.
- In your browser, copy the following line containing the Cortex XSOAR application client id:
https://account.box.com/api/oauth2/authorize?response_type=code&client_id=hznnisyhdf09nu9saf2eyfzupawrn9b2&state=lulubalulu
(client_id is demisto-application client id) - Click Grant access to Box. Allow access to it using your box credentials.
- You will be redirected to a non active page, with a url in this form:
https://localhost/?state=lulubalulu&code=MCTNCsN1gJIjA2cEJ72nczpXzcLVVQxJ - Copy the code from the url and use it the next step. (For example, copy MCTNCsN1gJIjA2cEJ72nczpXzcLVVQxJ)
- Run the box_initiate command with the access_code argument in the CLI in this form:
!box_initiate access_code=ACCESS_CODE
For additional information, watch https://www.youtube.com/watch?v=ha26tN8amI0
Or read about the box oauth2 process at https://developer.box.com/guides/authentication/oauth2/
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
box_get_current_user
Retrieves information about the user who is currently logged in i.e. the user for whom this auth token was generated
Base Command
box_get_current_user
Input
| Argument Name | Description | Required |
|---|---|---|
| verbose | Print verbose data on each user | Optional |
Context Output
There is no context output for this command.
Command Example
#### Context Example
```json
{}
Human Readable Output
Box account current user
ID Username Name Created at Status 14226607780 exampleuser@paloaltonetworks.com My Name 2020-09-25T15:23:39-07:00 active
box_get_users
Returns a list of all users for the Enterprise along with their user_id, public_name, and login
Base Command
box_get_users
Input
| Argument Name | Description | Required |
|---|---|---|
| filter_term | A string used to filter the results to only users starting with the filter_term in either the name or the login | Optional |
| limit | The number of records to return. The default is 100 and the max is 1000 | Optional |
| offset | The record at which to start. The default is 0 | Optional |
| user_type | The type of user to search for. Valid values are all, external or managed. If nothing is provided, the default behavior will be managed only | Optional |
| verbose | Print verbose data on each user | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Account | unknown | Account information of users returned by query, including ID, name and username |
Command Example
#### Context Example
```json
{
"Account": [
{
"Display Name": "My Name",
"Groups": "user",
"ID": "14226607780",
"Username": "exampleuser@paloaltonetworks.com",
"type": "Box"
}
]
}
Human Readable Output
Box account users
ID Username Name Created at Status 14226607780 exampleuser@paloaltonetworks.com My Name 2020-10-29T07:49:51-07:00 active
box_update_user
Used to edit the settings and information about a user
Base Command
box_update_user
Input
| Argument Name | Description | Required |
|---|---|---|
| notify | Whether the user should receive an email when they are rolled out of an enterprise | Optional |
| enterprise | Setting this to null will roll the user out of the enterprise and make them a free user. When passing a null value, do not pass this value as a string | Optional |
| name | The name of this user | Optional |
| role | string This user’s enterprise role | Optional |
| language | The language of this user | Optional |
| is_sync_enabled | Whether or not this user can use Box Sync | Optional |
| job_title | The user’s job title | Optional |
| phone | The user’s phone number | Optional |
| address | The user’s address | Optional |
| space_amount | The user’s total available space amount in byte. A value of -1 grants unlimited storage | Optional |
| tracking_codes | An array of key/value pairs set by the user’s admin | Optional |
| can_see_managed_users | boolean Whether this user can see other enterprise users in its contact list | Optional |
| status | Can be active, inactive, cannot_delete_edit, or cannot_delete_edit_upload | Optional |
| timezone | The timezone of this user | Optional |
| is_exempt_from_device_limits | Whether to exempt this user from Enterprise device limits | Optional |
| is_exempt_from_login_verification | Whether or not this user must use two-factor authentication | Optional |
| is_password_reset_required | Whether or not the user is required to reset password | Optional |
| user_id | The user id to update | Required |
Context Output
There is no context output for this command.
Command Example
!box_update_user user_id=14226607780
Context Example
{}
Human Readable Output
User updated
ID Username Name Created at Status 14226607780 eampleuser@paloaltonetworks.com My Name 2020-09-25T16:02:17-07:00 active
box_add_user
Used to provision a new user in an enterprise
Base Command
box_add_user
Input
| Argument Name | Description | Required |
|---|---|---|
| login | The email address this user uses to login | Required |
| name | The name of this user | Required |
| role | This user’s enterprise role. Can be coadmin or user | Optional |
| language | The language of this user | Optional |
| is_sync_enabled | Whether or not this user can use Box Sync | Optional |
| job_title | The user’s job title | Optional |
| phone | The user’s phone number | Optional |
| address | The user’s address | Optional |
| space_amount | The user’s total available space amount in bytes | Optional |
| tracking_codes | An array of key/value pairs set by the user’s admin | Optional |
| can_see_managed_users | Can be active, inactive, cannot_delete_edit, or cannot_delete_edit_upload | Optional |
| timezone | The timezone of this user | Optional |
| is_exempt_from_device_limits | Whether to exempt this user from Enterprise device limits | Optional |
| is_exempt_from_login_verification | Whether or not this user must use two-factor authentication | Optional |
Context Output
There is no context output for this command.
Command Example
!box_add_user login=exampleuser@paloaltonetworks.com name="My Name"
Context Example
{}
Human Readable Output
User created
ID Username Name Created at Status 14226607780 exampleuser@paloaltonetworks.com My Name 2020-10-29T07:49:51-07:00 active
box_delete_user
Deletes a user in an enterprise account
Base Command
box_delete_user
Input
| Argument Name | Description | Required |
|---|---|---|
| notify | Determines if the destination user should receive email notification of the transfer | Optional |
| force | Whether or not the user should be deleted even if this user still own files | Optional |
| user_id | The user id to update | Required |
Context Output
There is no context output for this command.
Command Example
!box_delete_user user_id=14226607780
Context Example
{}
Human Readable Output
User deleted
success
box_move_folder
Moves all of the owned content from within one user’s folder into a new folder in another user’s account. You can move folders across users as long as the you have administrative permissions and the ‘source’ user owns the folders. To move everything from the root folder, use “0” which always represents the root folder of a Box account (Currently only moving of the root folder (0) is supported)
Base Command
box_move_folder
Input
| Argument Name | Description | Required |
|---|---|---|
| from_user_id | The ID of the user who the folder will be transferred from | Required |
| to_user_id | The ID of the user who the folder will be transferred to | Required |
Context Output
There is no context output for this command.
Command Example
!box_move_folder from_user_id=13917563262 to_user_id=14226607780
Context Example
{}
Human Readable Output
Folder moved
Content is now available in account exampleuser@paloaltonetworks.com under directory exmple@example.com - My Name’s Files and Folders (2)
box_files_get
getting a file from private Box storage
Base Command
box_files_get
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | File’s id | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| File.Name | string | Filename |
| File.Type | string | File type |
| File.Size | number | File size |
| File.MD5 | string | MD5 hash of the file |
| File.SHA1 | string | SHA1 hash of the file |
| File.SHA256 | string | SHA256 hash of the file |
Command Example
!box_files_get file_id=723447059947
Context Example
{
"File": {
"EntryID": "863@6e069bc4-2a1e-43ea-8ed3-ea558e377751",
"Extension": "boxnote",
"Info": "boxnote",
"MD5": "5bb1cfa1f61f0f5322a10c401f869919",
"Name": "Untitled Note 2020-09-25 15.56.56.boxnote",
"SHA1": "fc9ed186f1e2b4b5a93cf8d0f698a86d396b7b2f",
"SHA256": "cd98285440b5d341c7ca37d389fa5c79558e8f681c26a165573321cfc1a5f3f5",
"SHA512": "590a0bcf34b13d5b1eab9ce48f1520f75708b137b2ef31053e881915cbf4eb54a39d7c5b15b06478f5cf4b09e2cedc41e45f99b3d3f3cbfbbc7f42749acb2627",
"SSDeep": "24:Y2YuI2qFcH3KUGIwYdAYsAuhvZqwNRpLk28:YfuAe3G6sA6TpP8",
"Size": 959,
"Type": "ASCII text, with very long lines, with no line terminators"
}
}
Human Readable Output
Untitled Note 2020-09-25 15.56.56.boxnote
box_initiate
Initialising of Box’s integration
Base Command
box_initiate
Input
| Argument Name | Description | Required |
|---|---|---|
| access_code | Box’s access code (see description) | Required |
Context Output
There is no context output for this command.
Command Example
!box_initiate access_code=wOK4V7vzcljJNTFu2mSDyQq7phlFY5nx
Context Example
{}
Human Readable Output
Box initialized successfully
box_files_get_info
Getting file info of provided ID
Base Command
box_files_get_info
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | File’s ID | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Size | number | Size of file (in bits) |
| Box.ContentModifiedAt | date | Time of content modification |
| Box.Sha1 | string | File’s SHA1 |
| Box.ModifiedAt | date | Time of file info |
| Box.Parent.Etag | string | Parent’s etag |
| Box.Parent.Id | string | Parent’s ID |
| Box.Parent.Name | string | Parent’s name |
| Box.SequenceId | string | Parent’s sequence ID |
| Box.Parent.Type | string | Parent’s type |
| Box.CreatedAt | date | Time of file’s upload |
| Box.Name | string | File’s name |
| Box.ModifiedBy.Id | string | ID’s of last user modified |
| Box.ModifiedBy.Login | string | User’s login email |
| Box.ModifiedBy.Name | string | User’s name of last modified |
| Box.ModifiedBy.User | string | User’s type |
| Box.ContentCreatedAt | date | File’s time of creation |
| Box.OwnedBy.Id | string | File’s owner ID |
| Box.OwnedBy.Login | string | File’s owner email |
| Box.OwnedBy.Name | string | File’s owner name |
| Box.OwnedBy.Type | string | File’s owner type |
| Box.SharedLink | string | Shared link |
| Box.Etag | string | File’s etag |
| Box.FileVersion.Id | string | File’s version ID |
| Box.FileVersion.Sha1 | string | File’s version SHA1 |
| Box.FileVersion.Type | string | File’s version type |
| Box.PathCollection.Entries.Etag | string | Path’s collection entries etag |
| Box.PathCollection.Entries.Id | string | Path’s collection entries ID |
| Box.PathCollection.Entries.Sha1 | string | Path’s collection entries SHA1 |
| Box.PathCollection.Entries.Name | string | Path’s collection entries name |
| Box.PathCollection.Entries.SequenceId | string | Path’s collection entries sequence_id |
| Box.PathCollection.Entries.Type | string | Path’s collection entries type |
| Box.PathCollection.TotalCount | string | Size of path_collection object |
| Box.PurgedAt | string | purged at |
| Box.Type | string | File’s type |
| Box.Id | string | File’s ID |
| Box.Description | string | File’s description |
| Box.ItemStatus | string | File’s status |
Command Example
!box_files_get_info file_id=723447059947
Context Example
{
"Box": {
"ContentCreatedAt": "2020-09-25T15:56:57-07:00",
"ContentModifiedAt": "2020-09-25T16:26:54-07:00",
"CreatedAt": "2020-09-25T15:56:57-07:00",
"CreatedBy": {
"Id": "14226607780",
"Login": "eampleuser@paloaltonetworks.com",
"Name": "My Name",
"Type": "user"
},
"Description": "",
"Etag": "1",
"FileVersion": {
"Id": "769566241780",
"Sha1": "fc9ed186f1e2b4b5a93cf8d0f698a86d396b7b2f",
"Type": "file_version"
},
"Id": "723447059947",
"ItemStatus": "active",
"ModifiedAt": "2020-09-25T16:27:19-07:00",
"ModifiedBy": {
"Id": "14226607780",
"Login": "eampleuser@paloaltonetworks.com",
"Name": "My Name",
"Type": "user"
},
"Name": "Untitled Note 2020-09-25 15.56.56.boxnote",
"OwnedBy": {
"Id": "14226607780",
"Login": "eampleuser@paloaltonetworks.com",
"Name": "My Name",
"Type": "user"
},
"Parent": {
"Etag": "0",
"Id": "123342801935",
"Name": "My Box Notes",
"SequenceId": "0",
"Type": "folder"
},
"PathCollection": {
"Entries": [
"0",
"1"
],
"TotalCount": 2
},
"PurgedAt": null,
"SequenceId": "1",
"Sha1": "fc9ed186f1e2b4b5a93cf8d0f698a86d396b7b2f",
"SharedLink": null,
"Size": 959,
"TrashedAt": null,
"Type": "file"
}
}
Human Readable Output
File info
Key Value ContentCreatedAt 2020-09-25T15:56:57-07:00 ContentModifiedAt 2020-09-25T16:26:54-07:00 CreatedAt 2020-09-25T15:56:57-07:00 CreatedBy.Id 14226607780 CreatedBy.Login exampleuser@paloaltonetworks.com CreatedBy.Name My Name CreatedBy.Type user Etag 1 FileVersion.Id 769566241780 FileVersion.Sha1 fc9ed186f1e2b4b5a93cf8d0f698a86d396b7b2f FileVersion.Type file_version Id 723447059947 ItemStatus active ModifiedAt 2020-09-25T16:27:19-07:00 ModifiedBy.Id 14226607780 ModifiedBy.Login exampleuser@paloaltonetworks.com ModifiedBy.Name My Name ModifiedBy.Type user Name Untitled Note 2020-09-25 15.56.56.boxnote OwnedBy.Id 14226607780 OwnedBy.Login exampleuser@paloaltonetworks.com OwnedBy.Name My Name OwnedBy.Type user Parent.Etag 0 Parent.Id 123342801935 Parent.Name My Box Notes Parent.SequenceId 0 Parent.Type folder PathCollection.Entries.0 0 PathCollection.Entries.1 1 PathCollection.TotalCount 2 SequenceId 1 Sha1 fc9ed186f1e2b4b5a93cf8d0f698a86d396b7b2f Size 959 Type file
Configuration parameters
insecure— Trust any certificate (not secure)
Commands (9)
-
box_add_userUsed to provision a new user in an enterprise
-
box_delete_userDeletes a user in an enterprise account
-
box_files_getgetting a file from private Box storage
-
box_files_get_infoGetting file info of provided ID
-
box_get_current_userRetrieves information about the user who is currently logged in i.e. the user for whom this auth token was generated
-
box_get_usersReturns a list of all users for the Enterprise along with their user_id, public_name, and login
-
box_initiateInitialising of Box's integration
-
box_move_folderMoves all of the owned content from within one user’s folder into a new folder in another user’s account. You can move folders across users as long as the you have administrative permissions and the ‘source’ user owns the folders. To move everything from the root folder, use “0” which always represents the root folder of a Box account (Currently only moving of the root folder (0) is supported)
-
box_update_userUsed to edit the settings and information about a user
/* params.code = access_code in new integration */ var Base = 'https://api.box.com/2.0/'; var BrandData = getBrandContext(); var ContextData = getIntegrationContext(); var CurrentTime = new Date(); var twoGraceMinute = 2 * 60 * 1000; function fileInfoKeysCamelized(old_obj){ /* Gettin a JSON Object and returning all keys in camelcases and without underscore */ var new_obj; if (old_obj instanceof Array){ new_obj = []; for (var k in old_obj){ new_obj.push(fileInfoKeysCamelized(k)); } }else if (old_obj instanceof Object){ new_obj = {}; for (var k in old_obj){ new_obj[underscoreToCamelCase(k)] = fileInfoKeysCamelized(old_obj[k]); } }else{ return old_obj; } return new_obj; } var sendRequest = function(method, url, body, token, redirect) { if (redirect === undefined){ redirect = true; } return http( url, { Method: method, Headers: token ? {'Authorization': ['Bearer ' + token]} : {}, Body: body, }, false, params.proxy, redirect ); } var getNewToken = function() { var request = { client_id: BrandData.client_id, client_secret: BrandData.client_secret, }; request.code = args.access_code ? args.access_code : params.code; // if there's no request code, return error if (!params.code && !args.access_code){ throw "There's no access code, please use box_initiate command."; } request.grant_type = 'authorization_code'; // Send it and get initial access token var response = sendRequest('POST', 'https://api.box.com/oauth2/token', encodeToURLQuery(request).substr(1), undefined); if (response.StatusCode < 200 || response.StatusCode >= 300) { throw 'Failed to get new token, request status code: ' + response.StatusCode + ' and Body: ' + response.Body + '.'; } // save new token newResponse = JSON.parse(response.Body); newResponse.expires_in = newResponse.expires_in * 1000 + CurrentTime.getTime(); newResponse.code = args.access_code ? args.access_code : params.code; setIntegrationContext(newResponse); return newResponse.access_token; } function refreshToken(){ ContextData = getIntegrationContext(); var request = { client_id: BrandData.client_id, client_secret: BrandData.client_secret, }; ContextData.expires_in += twoGraceMinute; setIntegrationContext(ContextData); // Build renewal request request.refresh_token = ContextData.refresh_token; request.grant_type = 'refresh_token'; // Send it and get new access token var response = sendRequest('POST', 'https://api.box.com/oauth2/token', encodeToURLQuery(request).substr(1), undefined); var i = 0; var isRefreshed = false; while (i < 5 && response.StatusCode === 401 && !isRefreshed) { // try to refresh 5 times if we got 401 ContextData = getIntegrationContext(); wait(Math.floor(Math.random() * 10)); isRefreshed = ContextData.expires_in > (10 * 60 * 1000 + CurrentTime.getTime()); i++; } if (response.StatusCode < 200 || response.StatusCode >= 300) { throw 'Failed to refresh token, request status code: ' + response.StatusCode + ' and Body: ' + response.Body + '.'; } // save new token and refresh token refreshResponse = JSON.parse(response.Body); refreshResponse.expires_in = refreshResponse.expires_in * 1000 + CurrentTime.getTime(); refreshResponse.code = args.access_code ? args.access_code : params.code; setIntegrationContext(refreshResponse); return refreshResponse.access_token; } var getToken = function(forceRefresh) { var returnToken = ''; ContextData = getIntegrationContext(); if (!Object.keys(ContextData).length) { // Build get initial tokens request returnToken = getNewToken(); } else if (forceRefresh || (ContextData.expiry && (ContextData.expires_in - twoGraceMinute > CurrentTime.getTime()))) { // Give this thread two minutes before trying to get a new token returnToken = refreshToken(); } else { // context exist and valid - return token from context returnToken = ContextData.access_token ; } return returnToken; } var urlDict = { 'box_get_current_user': 'users/me', 'box_get_users':'users', 'box_update_user':'users/', 'box_delete_user':'users/', 'box_add_user':'users', 'box_move_folder':'users/', 'box_files_get': 'files/$$/content', 'box_files_get_info': 'files/', 'box_files_upload': 'files/content' } var methodDict = { 'box_get_current_user': 'GET', 'box_get_users':'GET', 'box_update_user':'PUT', 'box_add_user':'POST', 'box_delete_user':'DELETE', 'box_move_folder':'PUT', 'box_files_get': 'GET', 'box_files_get_info': 'GET', 'box_files_upload': 'POST' } var userTableDict = { 'id':'ID', 'login':'Username', 'name':'Name', 'created_at':'Created at', 'status':'Status' } var userContextDict = { 'id':'ID', 'name':'Display Name', 'login':'Username', 'type':'Groups' } var encodeBody = function(command, args) { if (command === 'box_move_folder') { return JSON.stringify({'owned_by': { 'id': args['to_user_id']}}); } if (args && Object.keys(args).length) { if (typeof args.force === 'string') { args.force = args.force === 'true'; } return JSON.stringify(args); } return undefined; } var getURL = function(command, args) { var base = urlDict[command]; switch (command) { case 'box_update_user': case 'box_delete_user': base += args['user_id']; delete args['user_id']; break; case 'box_move_folder': // currently supporting only moving root folder (id:0) so setting it here hard-coded args['folder_id']=0; base += args['from_user_id'] + '/folders/' + args['folder_id']; delete args['from_user_id']; delete args['folder_id']; break; case 'box_files_get': base = urlDict[command].replace('$$', args['file_id']); delete args['file_id']; break; case 'box_files_get_info': // base hardcoded because of use in other commands base = urlDict[command] + args['file_id'] break; } return base } var usersToEc = function(users) { var ec={}; ec.Account=[]; if (!users) { return; } if (!Array.isArray(users)) { users = [users]; } for (var i=0;i<users.length;i++) { var user = {'type':'Box'}; for (var key in userContextDict) { user[userContextDict[key]] = users[i][key]; } ec.Account.push(user); } return ec; } var usersToMd = function(users,verbose) { var md =''; if (!users) { md += 'No users found\n'; return md; } if (!Array.isArray(users)) { users = [users]; } if (verbose=='true') { for (var i=0;i<users.length;i++) { md += '#### ' + users[i].login + '\n'; var head='|'; var line='|'; var data='|'; for (var key in users[i]) { head += key + '|'; line += '-|'; data += users[i][key] + '|'; } md += head + '\n' + line + '\n' + data + '\n'; } } else { var head = '|'; var line = '|'; for (var key in userTableDict) { head += userTableDict[key] + '|'; line += '-|'; } md += head + '\n' + line + '\n'; for (var i=0;i<users.length;i++) { md += '|'; for (var key in userTableDict) { md += users[i][key] + '|'; } md += '\n'; } } return md; }; function getFileInfo(){ // Getting file info var command = 'box_files_get_info' var method = methodDict['box_get_files_info'] var query = ''; var body = ''; var url = getURL(command, args); query = encodeToURLQuery(args); var response = sendRequest(method, Base + url + query, body, token, false); var i = 0; while (i < 5 && response.StatusCode === 401 || response.StatusCode === 400) { // try to refresh 5 times if we got 401 token = getToken(true); wait(Math.floor(Math.random() * 10)); response = sendRequest(method, Base + url + query, body, token, url, true); i++; } if (response.StatusCode < 200 || response.StatusCode >= 300) { throw 'Failed to ' + command + ', request status code: ' + response.StatusCode + ' and Body: ' + response.Body + '.'; } var md = ''; var ec = null; return response; } function getFiles(){ // Getting file info var name = JSON.parse(getFileInfo().Body).name; var method = methodDict[command]; var query = ''; var body = ''; var url = getURL(command, args); query = encodeToURLQuery(args); var response = sendRequest(method, Base + url + query, body, token, false); var i = 0; while (i < 5 && response.StatusCode === 401 || response.StatusCode === 400) { // try to refresh 5 times if we got 401 token = getToken(true); wait(Math.floor(Math.random() * 10)); response = sendRequest(method, Base + url + query, body, token, url, true); i++; } if (response.StatusCode < 200 || response.StatusCode >= 300) { throw 'Failed to ' + command + ', request status code: ' + response.StatusCode + ' and Body: ' + response.Body + '.'; } return {Type: 3, FileID: saveFile(response.Bytes), File: name, Contents: name}; } // Initialize token var token = getToken(false); switch (command) { case 'test-module': return "Please use box_initiate command to initialize Box's instance."; case 'box_initiate': var access_code = args.access_code; token = getToken(); var testResponse = sendRequest('GET', Base + urlDict['box_get_current_user'], undefined, token, 'Test'); if (testResponse.StatusCode === 200) { return 'Box initialized successfully'; } return {Type: entryTypes.error, Contents:'Get the following status code ' + testResponse.StatusCode}; case 'box_files_get': return getFiles(); default: var method = methodDict[command]; var query = ''; var body = ''; var url = getURL(command, args); if (method === 'GET') { query = encodeToURLQuery(args); } else { body = encodeBody(command, args); } var response = sendRequest(method, Base + url + query, body, token, url); var i = 0; while (i < 5 && response.StatusCode === 401) { // try to refresh 5 times if we got 401 token = getToken(true); wait(Math.floor(Math.random() * 10)); response = sendRequest(method, Base + url + query, body, token, url); response = sendRequest(method, Base + url + query, body, token, url); i++; } if (response.StatusCode < 200 || response.StatusCode >= 300) { throw 'Failed to ' + command + ', request status code: ' + response.StatusCode + ' and Body: ' + response.Body + '.'; } var md = ''; var ec = null; var contents = response.Body ? JSON.parse(response.Body) : 'success'; switch (command) { case 'box_get_users': md = '### Box account users\n'; md += usersToMd(contents.entries,args.verbose); ec = usersToEc(contents.entries); break; case 'box_get_current_user': md = '### Box account current user\n'; md += usersToMd(contents,args.verbose); break; case 'box_update_user': md = '### User updated\n'; md += usersToMd(contents,args.verbose); break; case 'box_add_user': md = '### User created\n'; md += usersToMd(contents,args.verbose); break; case 'box_delete_user': md = '### User deleted\n'; md += contents + '\n'; break; case 'box_move_folder': md = '### Folder moved\n'; md += 'Content is now available in account **' + contents.owned_by.login + '** under directory **' + contents.name + '**\n'; break; case 'box_files_get_info': contents = fileInfoKeysCamelized(contents); md = '### File info:\n'; md += objToMd(contents); ec = { 'Box(val.Sha1 === obj.Sha1)': contents }; break; default: md = "### Box Response: " + response.Status + '\n'; md += "#### response contents:\n" + objToMd(contents) + '\n'; } return {Type: entryTypes.note, Contents: contents, EntryContext: ec, ContentsFormat: formats.json, HumanReadable: md}; }