Delay before newly created folder (via the API) can be found by name
Hi
We are using the API to create folders. The folder appears instantly in the Box UI however when we try and load new files into the new folder (via the API) we are getting errors. It seems that we need to wait >10 minutes before we can send a file to the new folder.
Can anyone assist with this?
Thanks
SB
-
Hi ,
Can you walk me through how you're trying to load the files (e.g. the endpoint or method, are you using search, etc.) and what errors you're seeing please?
Typically the 5-10min indexing time applies to search indexing time, but the above data should help us try to figure this out.
Thanks,
Jon
-
Hi Jon
Basically we are using this endpoint
https://api.box.com/2.0/folders
to create a folder and the response is along the lines of
{"name":"John Doe 3 2020_04_28","parent":{"id":"1116XXXXXXX"}}
Then we use the endpoint
https://api.box.com/2.0/search?query=FOLDERNAME&type=folder&fields=id,name
but any request lest than 10 mins apart gets the response that no folder exists
{"total_count":0,"entries":[],"limit":30,"offset":0}
-
Hi ,
Thanks for the additional context. Based on the second search call that will definitely be the problem. The search endpoint will always have a 5-10min indexing delay for file in the current implementation.
What I would recommend doing is this: when you are creating new content you can capture the API response from the content create / upload, which will give you data about the new object immediately (e.g. name, ID, etc.). You can then intermix that with the results you get from searching for any other content that you'd like to expose.
- Jon
-
- That's right. Any direct lookup by an item's id value should be immediately available after a succesful create or update action. It's also generally the fastest way to get at an item, so if you have the luxury of knowing the id and keep it around for the session that's going to yield the best performance. Anything through the Search API (i.e. requests starting with api.box.com/2.0/search) will be subject to the indexing delay as the content is processed for search indexing.
If you have a use case that requires an immediate lookup but you can't or don't want to keep around the id value, one option is to use the newly available Metadata Query API. With it, you can add custom metadata to files or folders and then query them immediately. It doesn't have provide the fuzzy searching that the Search API does, but if you have well-structured metadata, it may be a good choice. Read more about it here: https://developer.box.com/guides/metadata/queries/
サインインしてコメントを残してください。
コメント
5件のコメント