Probably not the answer you’re looking for, but a few things:
- Library actions are usually sequences of actions that you repeat often. So you want to create a ‘function’ out of it. This has a few benefits:
- You don’t have to create the same sequence of actions in multiple ‘Server actions’, saving time
- You can create functions with a clear single purpose, making complex server actions easier to work with
- You can update one library action, and make sure that all the server actions who are using this library action will keep working properly
Here you can find documentation on them.
Especially check the ‘Using library actions’ section to see what the difference is between Exec and Include Creating Reusable Actions with Server Connect Library
One personal example of how I use library actions:
I have one called ‘get_current_schoolid’. My application is a SaaS, and every one of our customers has a school.
So the majority of server actions depend on which school we currently are… For example, if we are in school A and want to query the database to figure out which courses are in this school. Then we need to filter on school ID.
I can simply include this library action, and then use the school id that it gives me.
See this screenshot:
- API action is not to be used for wappler api actions (server actions). This is for connecting to an external api. For exmaple if you want to get the location by ip address, you can go here https://ip-api.com/docs/api:json and then use the API action to make it easy:
When they write this…
You can put http://ip-api.com/json/24.48.0.1
in the Url
param in Wappler. And set the Method
to GET
I definitely agree the wappler documentation is lacking, and do hope that it’ll get priority soon. But to be honest, I’ve found my way around it with the community + figuring things out by myself. I’ve made my own internal extensive wappler documentation by now haha