新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

BOXCLI --id-only not working

新規投稿

コメント

1件のコメント

  • amgrobelny

    Two things to note here:

     

    -id-only won't work because the option has two dashes "--id-only".

     

    Also, currently --id-only isn't supported on that command. If you need that feature, you can file an issue on the Box CLI Github for a feature request (https://github.com/box/boxcli).

     

    As you can see from the screenshot, --id-only is not a listed option for this command:

    Screen Shot 2017-11-02 at 3.47.07 PM.png

     

    In the meantime, you can parse the JSON from the API with Bash or PowerShell:

    Bash:

    There isn't a built in bash tool that lets you easily parse a JSON string. There are some tools you can download, but I opted just to use Python.

     

    box folders list-items 0 --json | python -c '

    import sys, json

    parsed = json.load(sys.stdin)["entries"]

    for entry in parsed:

      print entry["id"]

    ' >> ids.txt

     

    The spacing and line breaks are important here since it's Python. This writes out a list of the IDs to a .txt file. You can pipe the output to whatever you'd like. I just used creating a file as an example.

     

    PowerShell 

    PowerShell has a built in JSON parser:

     

    $json = box folders list-items 0 --json | ConvertFrom-Json

    echo $json.entries.id

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。