Best Practices: How do I pass a mass collection, specifically ids, as API parameter?

I have a custom module, I added a list view action that calls a custom API.

I have a couple of options in mind:

1) call the API once per ID of the potentially hundreds of selected items,

2) call the API passing the mass collection as a parameter (can I do that? what kind of object do I get in the php to retrieve the ids from?)

3) call the API passing a long string of IDs to be parsed at the other end (how long can you go before the URL for the API call gets too long? Hundreds of IDs can make for a pretty long string....

Any suggestions on how to best approach this issue?

thanks,

Francesca

Parents Reply Children
  • Francesca Shiekh,

    Throwing some ideas your way, that might or might not work depending on the specifics of the scenario:

    1. What about using post instead of get, if it is a custom API? Even if not fully RESTful "compliant"? The limit of the request is much bigger
    2. Is there any option/alternative to pass the filter id or the filter conditions only to the backend? And then complete a backend logic to understand which ones are the records? You could do that in a queue
    3. If that's not possible as they might be user selectable records, if the user is selecting manually the ids, as you said, you could call the api at every UI interaction for every id

    Maybe let me know more and I will noodle on it a bit

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States