Welcome to the new Box Support website. Check out all the details here on what’s changed.

BOX API call count

Answered
New post

Comments

5 comments

  • mwiller

     I help maintain the Box Java SDK that it appears you're using — I can give you guidance on the expected number of API calls for each usage pattern (assuming you're using the most current version of the SDK):

     

    1. The call to get info for the current user is 1 API call, but I'm a bit confused about what you're doing here — what is the BoxConfig being used for in this code sample?  Should I assume that the BoxAPIConnection object is already instantiated and set up?
    2. The call to searchRange() is 1 call, iterating over the partial collection is free since it does not automatically fetch more results from the API.  If you want more results than that call gave you, you'll need to make another call to searchRange().
    3. Adding metadata to a file is 1 API call.

    You can check all of this for yourself by intercepting the API calls to Box and doing some logging/counting or whatever you want:

     

    boxConn.setRequestInterceptor(new RequestInterceptor() {
        @Override
        public BoxAPIResponse onRequest(BoxAPIRequest request) {
            // Do whatever counting or logging you want with the request
            return null;
        }
    });
    0
    Comment actions Permalink
  • shanvaradan

    Hi Box Team,

    As I mentioned in my email I removed all non box code including below:

    Reader reader = new FileReader(configFile); (where config file is the json with keys).

    setRequestInterceptor is what I need. Rest of your answers confirms our understanding is right.

    The utility will search and update box file with metadata, we want to fine tune the solution to make as less api calls as possible.

    Leaving aside getting connection etc which are one time, it is going to be:

    1. 1 API call for updating metadata + total file count\limit (which seems to have a low ceiling of 200 per below document)

    https://github.com/box/box-java-sdk/blob/master/src/main/java/com/box/sdk/BoxSearch.java

    Is it possible to override this to 1000 (limit --> page size). We will try anyway and post the results back.

    Is there a batch api where we could do this with lesser api calls.

    Thanks for the quick response.

    Sundar.

    0
    Comment actions Permalink
  • mwiller

     Per the Search API reference documentation, the maximum value for the limit parameter is indeed 200.  The Java SDK does include a Batch API, but it does not work the way you're thinking — multiple search operations in a single batch would still each count against rate limits since our backend still has to do the work on those queries.

    0
    Comment actions Permalink
  • shanvaradan

    Thanks for the quick response.

    Batch API question was more for updating multiple files (with metadata) in one call.

    Does batch update also result in same number of API calls as updating file one by one.



    Thanks,

    Sundar.

    0
    Comment actions Permalink
  • mwiller

     Yes, in general Batch API does not reduce the consumption of rate limits.  This is because on the backend we still have to do the same amount of work to make N updates, whether it's in one API call or N API calls.  That load on our backend systems is part of what our rate limits are designed to limit, not just network traffic to our data centers.

    0
    Comment actions Permalink

Please sign in to leave a comment.