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

Box CLI search command

回答済み
新規投稿

コメント

10件のコメント

  • Kourtney

    Hey Matt! 

     

    Thanks so much for using our Platform and Development Forum! 

     

    One important thing to keep in mind is that the account the CLI is associated with is the JWT service account. Therefore, when you search without using the as-user header, you're only searching within the service account's folder tree. Is "move-test" in a file/folder located in your account or in the service account? 

     

    Also, what response are you seeing when you make this call? 

     

    Best, 

    Kourtney 

    0
    コメントアクション Permalink
  • matt-lindsay

    Hi Kourtney,

     

    Thanks for getting back to me. I'm using my own user ID as I'm the Box Administrator. The file was created by myself, located in a folder created by myself.

     

    The error response I'm getting is as follows.

     

    {                                                                
      "type": "error",                                               
      "status": 400,                                                 
      "code": "bad_request",                                         
      "context_info": {                                              
        "errors": [                                                  
          {                                                          
            "reason": "invalid_parameter",                           
            "name": "created",                                       
            "message": "Invalid value '2018-03-03T09:06:17 00:00'."  
          }                                                          
        ]                                                            
      },                                                             
      "help_url": "http://developers.box.com/docs/#errors",          
      "message": "Bad Request",                                      
      "request_id": "i3egr3fuweyl4uwb"                               
    }                                                                

    It doesn't tell me which parameter is invalid though. I've tried several permutations of the the command string with no success.

     

    I can use other 'files', 'folders' and 'users' commands to find the information I need to complete my task, which was to build a script to bulk move several thousand files from one folder to another. I thought it would be quicker to use the 'search' API though as fewer commands would have to be typed to build my script.

     

    Thanks,

     

    Matt.

    0
    コメントアクション Permalink
  • Kourtney

    Matt, 

     

    The error I'm seeing on the backend is: "Invalid+date+in+the+date+range+for+created"

     

    Please ensure the date you're passing is formatted correctly. If you go to https://developer.box.com/v2.0/reference#api-docs-directory and scroll down to the "Date Format" section there are some examples of proper formatting. 

     

    Best, 

    Kourtney 

    0
    コメントアクション Permalink
  • matt-lindsay

    Hi Kourtney,

     

    Thanks for getting back to me. The search string I'm passing is as follows:

     

    PS>box search "Folder name with spaces" --as-user myuserid

    At no point am I passing in a date value.

     

    Thanks, Matt.

    0
    コメントアクション Permalink
  • Kourtney

     hmm that's interesting since the error was indicating 2018-03-T09:06:17 00:00 was being used. 

     

    Can you make this call again and then provide me with: 

     

    • full body response including the request ID 
    • date/time/timezone of the error
    0
    コメントアクション Permalink
  • matt-lindsay

    Hi ,

     

    I've run the request again, please find the response body below.

     

    {                                                               
      "type": "error",                                              
      "status": 400,                                                
      "code": "bad_request",                                        
      "context_info": {                                             
        "errors": [                                                 
          {                                                         
            "reason": "invalid_parameter",                          
            "name": "created",                                      
            "message": "Invalid value '2018-04-16T08:57:42 01:00'." 
          }                                                         
        ]                                                           
      },                                                            
      "help_url": "http://developers.box.com/docs/#errors",         
      "message": "Bad Request",                                     
      "request_id": "gs5a8tfwa4cwx4b0"                              
    }

    The time zone I'm in is London (UTC + 1:00) and I ran this request at about 08:57 on the 16/10/2018.

     

    Thanks,

    Matt.

     

     

    0
    コメントアクション Permalink
  • Kourtney

    Thanks for the info ! Could you do one more thing for me? In the CLI do the command below and let me know what version of the CLI is returned: 

     

    box -v

     

    0
    コメントアクション Permalink
  • matt-lindsay

    Hi ,

     

    I'm on v1.0.2.

     

    Thanks, Matt.

    0
    コメントアクション Permalink
  • Kourtney

     could you please try upgrading to the most recent version of the CLI? I've been unable to reproduce the behavior you're seeing and I'm on v1.1.1. 

    0
    コメントアクション Permalink
  • matt-lindsay

    Hi I've upgraded, its working now! That's great, thanks for your help.

    0
    コメントアクション Permalink

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