Please log in to watch this conference skillscast.
It can be achieved in three ways:
Sending multiple requests to the server and implementing all the processing logic in the client. The advantage of this approach is that the server remains unchanged and the client can easily change the logic and flow of requests. The disadvantage is the latency and the traffic - each request should travel via the network.
Implementing additional methods/endpoints/parameters in the server. The advantage of this approach is that the client has to make only one request. The disadvantage is that it requires changing the server (= coding + testing + documenting + deploying + monitoring + supporting...). When it is possible, it inevitably leads to the growing complexity of the remote system as more and more specialised methods/APIs are added to it.
Implement batch endpoints, e.g. using JSON RPC standard. While they allows to execute multiple calls in a single HTTP request, it doesn’t allow to implement any logic between the calls.
JSONScript is a simple tool that allows to create “a batch endpoint on steroids” - server-side scripted execution of existing endpoints and services.
It is currently implemented in express middleware that allows to add JSONScript batch endpoint in a single line of code.
YOU MAY ALSO LIKE:
- Lightning Talk: Coding: You Either Love Or Hate It, Or Why You Should Open-Source For Real. (SkillsCast recorded in July 2019)
- Getting API Design Right: Learning from Anti-Patterns — Full‑Day Workshop [SAG Digital 2021] (Online Course on 11th October 2021)
- Why An API Story? (SkillsCast recorded in June 2021)
- Dev Faster with Contract Driven API Development (SkillsCast recorded in April 2021)
Batch execution of existing endpoints and services with JSONScript