Adapters: Best way to add page[size]=ids.length in all findMany or query by many ids?

Hey guys,

So, the API team has made the decision to restrict all requests to return a max of 10 resources in our JSON API unless we specifically set the page[size]=# param.

I’ve spoke with them and this breaks many cases where our relationships have more than 10. We’ve decided that it’s fine to just add the param page[size]=9999 in any request that is looking by many ids.

My thought process is to update our Application Adapter and override the urlForFindMany and simply:

//.... adapters/application.js
urlForFindMany(ids, modelName) {
    let baseUrl = this.buildURL();
    baseUrl += '/' + modelName + '/?page[size]=9999';
    return baseUrl;

Would this be sufficient for all possible scenarios Ember data requests multiple resources by ids or all relationships?

Update For anyone looking for an answer, this does seem to be the best spot. We ended up changing it to add the ids.length count instead of 9999.

urlForFindMany(ids, modelName) {
    return `${this.buildURL()}/${modelName}/?page[size]=${ids.length}`;
1 Like

That spot looks good to me. I wonder of using the length might lead to multi-user confusion?

User A has a parent model with 5 children. User B adds a child…

But that would be asynchronous and happen after the request has already been made for the N relationships. Or am I not following you?

You are following. I don’t know the particulars of your implentation so I just raised the question. It may not have been a valid one.