Skip to main content
Question

box cli search and using --ancestor-folder-ids

  • May 22, 2025
  • 4 replies
  • 43 views

Forum|alt.badge.img

When I use box cli search with --ancestor-folder-ids, I get a 404

 

box search xxxx --scope enterprise_content --content-types files --ancestor-folder-ids xxxxxxxx | jq '[limit(3;.[] | select(.name | contains("xxxxx")))]'
Unexpected API Response [404 Not Found | nku76jg8iy92083s.06c47f7fd3799a7db01040e00762bb10] not_found - Not Found

 

When I take out --ancestor-folder-ids, i get back results.  Is there a known bug?

 

thanks!

 

4 replies

Forum|alt.badge.img

Hi ,

 

This is most likely due to the access token not being scoped for the user that owns the folder IDs that you're specifying. If that's the cause, basically you're making calls on behalf of an account (e.g. the service account) when they don't have permission to the folders that you're specifying. 

 

If you run a box users:get me call you can see the account that the token is scoped for. Make sure that the folder IDs you've specified is ancestor-folders-ids are owned by that user or that the user has been collaborated in on those folders to permit them to search. 

 

An easy way to check if the user has access is to run box:folders get ID. If you get a 404 then that's the issue. 

 

Thanks,

Jon


Forum|alt.badge.img

I think that's why I'm confused.  I can get box folder:get xxxxx

the other thing is I have GAC enabled for this app with enterprise scope and all permissions enabled.


Forum|alt.badge.img

Ok I'll try to add the automationUser as a collaborator to the folder. 


Forum|alt.badge.img

So taking out ancestor-folder-id and doing something like this might be the solution since i get results from this.

 

box search xxxx --scope enterprise_content --content-types files --fields name,path_collection | jq '.[] | select(.path_collection.entries[1].id == "xxxxxx")'