We often have this issue as well. There are things you can do to optimize though, a simple slurp wont help.
If you are hitting API/v2/hosts for 350 objects and it is rendering “everything” that will be slow and take a while as it gives you “everything” for each host.
Add the thin=true API argument to just return the fqdn’s. Your query will return in far less than a second then, even if it’s thousands of hosts. From there, iterate through, and query "only’ what you need from each host
/API/v2/hosts/fqdn returns ALL
/API/v2/hosts/fqdn/parameters returns just parameters (faster)
/API/v2/hosts/fqdn/parameters/paramname retusn a single host parameter (fastest)
Foreman is also able to process multiple transactions at once provided it has the resources to do so.
In our case we encourage people to multithread a fair bit through a host list returning what they need as we have something like 80 passenger process instances running which can make it much much faster.
Another alternative is do your own caching. Build a custom API to get what you want fast internally. Query foreman “slowly” on an interval (hourly) and populate your own API so you can get what you need “fast”
Generally I’ve always thought it would be nice if the hosts endpoint (or all API endpoints) had a “fields” filter to just whitelist/return what you want/need, as it would probably speed it up significantly vs returning “everything” but I have no idea how practical that is…