box / boxcli

A command line interface for interacting with the Box API.
https://developer.box.com
Apache License 2.0
222 stars 59 forks source link

boxcli: Get a file embed URL #439

Closed skchronicles closed 1 year ago

skchronicles commented 1 year ago

Get a file embed URL

Description of the Issue

It is possible to currently get/generate a file embed URL with the box cli. I tried searching through your documentation, and I couldn't find any information. I know it is possible with the python SDK. If this is not possible, would it be possible to add in a future release of the tool?

image

Thank you for the help and maintaining this awesome tool, @skchronicles

arjankowski commented 1 year ago

Hi @skchronicles ,

Some of the file properties are not returned by default, when executing the files:get command. expiring_embed_link is just on of them. To obtain them, you must explicitly indicate them in the fields parameter when executing the command. Please read this.

So to get the embed_url for a file you can exectue the following command:

box files: get <FILE_ID> --json --fields='expiring_embed_link'

Then the url will be placed in the expiring_embed_link.url property.

Hope this help! Artur

skchronicles commented 1 year ago

Okay, that sounds good. Thank you for the help!