Search Results :

×

Setup the Custom API extension for Joomla


A Custom API plugin that lets you create custom APIs to expand the capabilities of the Joomla CMS (Content Management System). By using these APIs you can expose particular features or data from your Joomla website, allowing external programs or services to communicate with your Joomla website. With the help of the custom endpoints you have developed, this plugin offers a smooth method to work with the Joomla database, enabling you to easily carry out CRUD (Create, Read, Update, and Delete) operations.

Pre-requisites: Download And Installation

Installation

  • Download the zip file for the miniOrange Custom API plugin for Joomla from the link here.
  • Login into your Joomla site’s Administrator console.
  • From left toggle menu, click on System, then under Install section click on Extensions.
  • Downlaod and Intall Custom API plugin
  • Here click on Browse for file button to locate and install the plugin file downloaded earlier.
  • Install the Custom API Plugin from your computer
  • Once Installation of plugin is successful. Now click on Start Using miniOrange Custom API plugin.
  • Start Using miniOrange Custom API plugin

Configure Custom API Plugin

1. Create Custom APIs :

miniorange img Why GET API:

  • 1) If you want to retrieve data or information from your Joomla site, then you can create a GET API. You can add multiple filters, conditions to the get API using our plugin.
  • 2) When you make a GET request to an API, you can provide parameters or query strings in the URL to specify the data you want to retrieve from your Joomla site. The Joomla Custom API plugin then processes the request and returns the requested data in the response.

miniorange img Configuration to create Custom GET API:

  • Navigate to Joomla Create Custom APIs tab and click on click here button.
  • Joomla Create Custom API
  • Now enter the API name you want to provide to the API. Please confirm that you haven’t added any space in the name of API.
  • Then select the GET method from the dropdown.
  • Now select the table name on which you want to perform the data retrieve action.
  • Joomla Custom GET method
  • It will now show multiple options to select columns and filters for this API. Please specify the columns of the table from which you would like to retrieve data from the Joomla site. You can select the multiple columns here.
  • Choose appropriate conditions according to your requirements or you can opt for no condition as well. Click on + button if you want to add multiple WHERE conditions to filter out the data. You can remove the condition as well by clicking the - button.
  • At last if you want to order your data, select the ORDERBY filter.
  • After configuring the API , click on Save button at last to create your Custom endpoint / REST API.
  • Joomla custom API endpoint - REST
                        API

miniorange img   How to use Created GET API:

  • Once you click the Save button, you will receive your Custom API/endpoint. You can utilize this API on any platform based on your specific requirements.
  • Custom API for Joomla -How to create get API
  • You need to pass parameters present in the Request format table in the form of query parameters of your request.
  • To retrieve the data of users of above example you need to follow the following:
    • 1) Enter the URL ‘http://localhost/joomla_4.3.1/api/index.php/v1/mini/custom_get’.
    • 2) Then select the GET HTTP method.
    • 3) Pass id as a query parameter.
  • You will receive an API response in JSON format as shown below.
  • Custom Endpoint for Joomla - Custom API response in JSON format

2. Create Custom SQL APIs:

miniorange img Configuration to create Custom SQL GET API:

  • 1. Navigate to Joomla Create SQL APIs tab and click on click here button.
  • Joomla Create SQL API
  • Now enter the API name you want to provide to the API. Please confirm that you haven’t added any space in the name of API.
  • Then select the method GET from the dropdown.
  • Note: You can also enable custom query parameters if you want to send a custom parameter in the API request
  • Write the Custom SQL Query that you want to execute on the successful API call.
  • Joomla Create SQL API name
  • Note: To send custom parameters, you can write the query like the following: SELECT * FROM #__users WHERE id='{{id_param}}' AND email='{{email_param}}'; having _ is mandatory in the parameter name.
  • Click on Save button at last to create your Custom endpoint / REST API.

miniorange img How to use Created SQL GET API:

  • Once you click the Save button, you will receive your Custom API/endpoint. You can utilize this API on any platform based on your specific requirements.
  • Joomla SQL API- custom API endpoints
  • To retrieve the data of users of above example you need to follow the following:
    • 1) Enter the URL ‘http://localhost/joomla_4.3.1/api/index.php/v1/mini/sql_get’.
    • 2) Then select the GET HTTP method.
    • 3) Pass id, email as a query parameter.
  • You will receive an API response in JSON format as shown below.
  • Joomla SQL API- JSON format

3. Edit the existing API:

  • Click on the edit button in the front of the Custom API you want to edit.
  • Setup Custom API for Joomla - Edit the
                    existing API
  • Update the API as per your requirements and then click on Save. Then use the updated API according to your requirement.

4. Restricting Public Access to Custom API:

  • Click on Add Authentication tab in the navigation bar of the plugin.
  • Enable the button if you want to add Token based Authentication to your custom APIs.
  • You can choose the HTTP methods for which you want to add an authentication method.
  • Then click on the Save button.
  • Now you can click on the “SHOW” icon to check your Bearer Token and you can also generate a new key by clicking on “Generate new key”.
  • Joomla Custom API - Generate new key
  • To access restricted APIs you need to pass your Bearer Token value in Bearer Token of Authorization.
  • Joomla Custom API- Bearer Token

5. External API Configuration:

miniorange img Configure External APIs with different Methods:

  • Navigate to the External APIs tab and click on Configure External API button.
  • Enter the API Name you want to give to the API connection. This API name should be unique as it will be used to connect it with Joomla.
  • Select the method according to your external API from the Select Method dropdown which you want to connect to the Joomla site.
  • Joomla External API with different Methods
  • You can pass query parameters which are necessary for this configured API. For the data to be sent in the query parameters format:
    • 1) There are 2 text fields - first is to enter the key and second one is to enter the value.
    • 2) For example→ If you have to pass the following query parameter ‘username→testuser’ then you need to put the ‘username’ in the key and ’testuser’ in the value field.
    • 3) You can add multiple parameters using + button.
  • In the Headers, there are 2 text boxes - the left one is for the header name and the right one if for the header value that needs to be passed. For example : If the header passed to be in the format Authorization:Bearer then the ‘Authorization’ will be added in the first textbox and ‘Bearer should be put in the right textbox as shown in the diagram below.
  • Joomla External API with different Methods
  • If the API provider expects the data needs to be sent in the body of the API endpoints request, then you can fill in the required details. There are 2 formats available in which you can send the data : x-www-form-urlencoded and JSON.
  • For the data to be sent in the body parameters in x-www-form-urlencoded format:
    • 1) There are 2 text fields - first is to enter the key and second one is to enter the value.
    • 2) For example→ If you have to pass the following body parameter ‘username→testuser’ then you need to put the ‘username’ in the key and ’testuser’ in the value field.
    • 3) For the multiple key value pairs that need to be passed in the request body of the API endpoint request, you can click on the + button.
  • For the data to be sent in the body parameters in JSON format: You need to select the JSON from the dropdown corresponding to the Request Body
  • Joomla parameters in JSON format
  • Now click on the Save button.
  • Then click on Test Configuration To test the API connection and fetch the response. You will receive the Attributes Table as shown below.
  • Setup Custom API for Joomla

miniorange img Short Codes for External APIs:

  • After configuring the external API you will receive short code for a particular API.
  • Setup Custom API for Joomla- Short Codes for External APIs
  • You can use this shortcode in Joomla articles to show the data to your Article.

Business Trial

If you want Business Trial for FREE Click Here

If you don't find what you are looking for, please contact us at joomlasupport@xecurify.com or call us at +1 978 658 9387.

Hello there!

Need Help? We are right here!

support