This is both a tip and a bold assertion: It is better plugin development practice to call external services in Server Side Actions using Bubble’s
context.request() wrapper function around the Node Request Module than to use Bubble’s API call interface. I have five reasons for this claim, that revolve around the first claim:
- Server side functions allow for incremental development, whereas API calls require monolithic development. To get an API Call working you basically are required to have all your inputs and outputs wired up and ready to go; which gets ugly quickly for all but the simplest interfaces. In contrast with Server Side Actions we can incrementally add inputs, outputs, and coercion logic. This provides three more benefits.
- We can prune optional inputs from any submitted JSON, and coerce them much more flexibly
- We can coerce and most importantly dimensionalize returned objects into flattened arrays of primitives, especially for interfaces that return key-value dictionaries.
- Debugging and error trapping is far more straightforward in Action.
- Increased security transparency. With Server Side Actions you are guaranteed the call is being made server to server; which is important for doing things like negotiating nonce signed tokens to access video services.
Now with all that said for Bubble to really make this work they would need to either:
- Provide Serve Side Actions with the same kind of integrated automagic authentication that is in API Calls. Maybe adding some form of