- When an API is called, it executes a list of actions
- Each action provides specific functionality such as sending an email, creating a DNN user and so on
- Stack any number of actions. They are executed in the order you specify
- If an error occurs, the execution is stopped
- New actions can be added via add-ons or implemented in custom assemblies
We begin with the most common example for understanding the difference between the methods in order to establish the actions which should be used according to what we want to request. When a user of a web browser enters an URL and presses enter, that creates an HTTP GET request, and when the user fills in a data entry form, and clicks the submit button, that can create either a GET or a POST request depending on how the form is constructed. The HTTP requests will be interpreted as requests for particular actions on the server and the data is returned as XML or JSON
DNN API Endpoint module provides all sorts of actions which can be defined to perform a certain operation and to be executed. Most actions return an instance that derives from results, depending on the task the action method is performing.
Bellow are listed all the available actions which can be used on the API Endpoint module:
- Change User
Allows to set up some actions so that the users can update the profile information.
- Inject Data
This action can manually write data into the context which is stored under a name and can be accessed through tokens.
- Load User
Used to manually set a user on the action to be executed on the method - it also accepts the use of the tokens
- Execute SQL Query
Can be used for all the methods, with a POST method to insert new values in database, with a GET method to export the registrations from a certain table, with a PUT method to edit/update existing values, with a DELETE method to remove the desired values from database. Frequently, the columns which can be used to be extracted are added to the list of results to be returned. Usually, the result is fetched and converted into a JSON string (or an XML depending on the response options you've selected).
- Server Request
Is used when you want to make a call to the URL generated by the created method.
- Send Email
Usually this action is used on a POST method in order to send customized emails.
- Load Entities (SQL)
Used for when you want to list all or some registrations from the database, you can create a GET method with this action in order to make an SQL Select statement where you can optionally define which columns to export.
We usually use this action as an additional filed for a request where we need to send back data to the browser.
- Collect PayPal Payment
A PayPal payment can be set and when the HTTP request is made, a redirect to the PayPal website is made.
- User Login
This action comes very handy when we need to create a POST method which we'll use to log in existing members - for more examples on the User actions go to Test API Methods page.