Box CLI: starting

Highlighted
Occasional Contributor

Box CLI: starting

I know a little bit about programming, but I'm not an expert. I'm willing to learn...

 

I have a database in Filemaker, on which I automized a lot of tasks (wriiting letters, mails, ...) with AppleScript (yes, I'm a Mac users). I've a box business abonnement.

 

I never use the box on the web, but I copy files to my box account with Box Drive or Box Sync (depending on the computer I work on).  When I have to send a large file, I create a shared link of a file and copy te link in a mail. I do this by right clicking when I have selected the file in Finder.

 

Now, I want to write a script which can grab the shared link if I know the path to that file.

 

After, looking around, ask a lot of question on fora, I have learned that Box CKI can do the thing for me. So, I follow the steps described on (Box CLI)  and I got no errors. But, now it begins, and I'm stukkend:

  • Where can I find my id?
  • How do I get the ID of a file if I only know the path?

 

Can someone help me of point me out to a good comprehensible manual?

 

Thank in advance,

 

Amelie

 

3 REPLIES 3
Highlighted
Occasional Contributor

Re: Box CLI: starting

After trying a couple of things, I get the following things.

 

When I give te commando:

box folders:get 0

I get the following output:

MacBook-Pro-5:~ Amelie$ box folders:get 0
Type: folder
ID: '0'
Sequence ID: null
ETag: null
Name: Alle bestanden
Created At: null
Modified At: null
Description: ''
Size: 0
Path Collection:
    Total Count: 0
    Entries: []
Created By:
    Type: user
    ID: ''
    Name: ''
    Login: ''
Modified By:
    Type: user
    ID: '11111111111'
    Name: xxx
    Login: ***email address removed for privacy***
Trashed At: null
Purged At: null
Content Created At: null
Content Modified At: null
Owned By:
    Type: user
    ID: '11111111111'
    Name: xxx
    Login: ***email address removed for privacy***
Shared Link: null
Folder Upload Email: null
Parent: null
Item Status: active
Item Collection:
    Total Count: 0
    Entries: []
    Offset: 0
    Limit: 100
    Order:
        -
            By: type
            Direction: ASC
        -
            By: name
            Direction: ASC

 And, when I give the commando:

box users:get 11111111111

I get:

Type: user
ID: '11111111111'
Name: xxx
Login: ***email address removed for privacy***
Created At: '2020-04-23T00:25:53-07:00'
Modified At: '2020-04-23T00:26:28-07:00'
Language: nl
Timezone: Europe/London
Space Amount: 10737418240
Space Used: 0
Max Upload Size***phone number removed for privacy***Status: active
Job Title: ''
Phone: ''
Address: ''
Avatar URL: 'https://app.box.com/api/avatar/large/11111111111'
Notification Email: []

But, when I give the commando:

box search "Bridges"

I get nothing, even though the folder 'Bridges' exists on my box account.

 

What am I doing wrong?

 

 

Highlighted
Occasional Contributor

Re: Box CLI: starting

@Amelie 

 

If you run the command

box users:get me

What is the output? This will return the user you are running your calls as in the CLI . I suspect you are making calls as your service account ( this will show as automationuser_serviceid_randomstringnumbers as the user login) rather than an actual Box User.

 

Highlighted
Box Employee

Re: Box CLI: starting

Hi Amelie!

 

Thanks for coming to the Box Developer forums to ask these CLI questions. I'd like to provide a bit more info for you about File/Folder IDs in Box. 

 

The easiest way to know all of the file and folder IDs for content in your account is to export a files and folders report from your Admin Console: Running Reports

This will give you an Excel file listing all of your enterprise's contents, the IDs for each item, and the IDs for all items along the path.

Alternatively, you can always find the ID for an item in Box while viewing the content on Box.com. The file or folder ID is the string of numbers after either "/file/" or "/folder/" in the URL.

 

For more help with searching content using CLI, I'd recommend familiarizing yourself with the Box API's search call: https://developer.box.com/reference/get-search/#param-query

I'd also recommend checking out this discussion on exact search matching in CLI: https://community.box.com/t5/Platform-and-Development-Forum/CLI-Search-for-exact-match/m-p/62695/hig...

 

Thanks for coming to the Box Developer Forum! Hope this information helps.