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

miniorange img Why POST API:

  • 1) If you want to send data to your Joomla site to create resources on the site, then you can use the POST API.
  • 2) When you make a POST request to an API, you send data in the body of the request, typically in JSON or form-encoded format. The Joomla Custom API plugin then processes the data and performs the necessary actions based on the information provided in the request.

miniorange img Configuration to create Custom POST API:

  • Navigate to Joomla Create Custom APIs tab and click on click here button.
  • 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 POST method from the dropdown.
  • Now select the table name on which you want to enter new data. Then Click on Save button.
  • Custom Rest API for Joomla- Custom API POST method
  • Then select the columns for which you are providing the data to add entry in the table.
  • Now you can select the data format in which you want to send the data to the header.
  • Custom API for Joomla
  • After configuring the API , click on Save button at last to create your Custom endpoint/ REST API.

miniorange img How to use Created POST 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 - Custom Endpoint for Joomla
  • To provide data for the columns mentioned in the "Request format" table, you should include the necessary values in the body of your request.
  • Please ensure that the body data format matches the format specified in the "Body data format" section.
  • To add entry to usergroup table 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_post’.
    • 2) Then select the POST HTTP method.
    • 3) Pass data for id, parent_id ,lft ,rgt, title in the body of the request.
  • You will receive 1 in the response if data successfully entered in the table.
  • Custom Rest API for Joomla

miniorange img Why PUT API:

  • 1) If you want to update or replace an existing resource on your Joomla site, then you can create a PUT API.
  • 2) When you make a PUT request to an API, you send data in parameters or query strings or in the body of the request to replace the entire representation of the resource identified by the request URL. The Joomla Custom API plugin then processes the data and updates the resource accordingly.

miniorange img Configuration to create Custom PUT API

  • Navigate to Joomla Create Custom APIs tab and click on click here button.
  • 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 PUT from the dropdown.
  • Now select the table name on which you want to enter new data.
  • Custom Rest API for Joomla - Custom API method PUT
  • Then select the columns for which you want to update using the API call.
  • 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.
  • Custom Endpoint for Joomla- Custom PUT API
  • After configuring the API , click on Save button at last to create your Custom endpoint/ REST API.

miniorange img How to use PUT 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 Rest API for Joomla -Custom PUT API
  • You have the flexibility to pass the data either as query parameters or within the body of the request.
  • Ensure that you pass the data using the format key=Parameter Name(mentioned in Request Format and Conditions Applied table) and value=according to the specific requirements.
  • To update user entry 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_put’.
    • 2) Then select the PUT HTTP method.
    • 3) Pass data for name, username, param_1,param_2 in the body of the request(You can pass in the query format also).
  • You will receive 1 in the response if data successfully updated in the table.
  • Custom API for Joomla - Custom API successful Updated

miniorange img Why DELETE API:

  • 1) If you want to delete a specific resource on your Joomla site, then you can create a DELETE API.
  • 2) When you make a DELETE request to an API, you can provide parameters or query strings in the URL or in the body of the request to specify the data you want to delete from your Joomla site. The Joomla Custom API plugin then processes the data and updates the resource accordingly.

miniorange img Configuration to create Custom DELETE API:

  • Navigate to Joomla Create Custom APIs tab and click on click here button.
  • 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 DELETE from the dropdown.
  • Now select the table name of which you want to delete the data.
  • Joomla Custom Delete Method
  • 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.
  • Joomla Custom Delete methods
  • After configuring the API , click on Save button at last to create your Custom endpoint/ REST API.

miniorange img How to use DELETE 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 Custom Delete API-Custom API endpoints
  • You have the flexibility to pass the data either as query parameters or within the body of the request.
  • Ensure that you pass the data using the format key=Parameter Name(mentioned in Request Format and Conditions Applied table) and value=according to the specific requirements.
  • To delete user entry 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_delete’.
    • 2) Then select the DELETE HTTP method.
    • 3) Pass data for param_1 in the body of the request(You can pass in the query format also).
  • You will receive 1 in the response if data successfully deleted in the table.
  • Joomla Custom delete API

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

miniorange img Configuration to create Custom SQL POST API:

  • Navigate to Joomla Create SQL APIs tab and click on click here button.
  • 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 POST 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 Custom SQL Post- sql query
  • Note: To send custom parameters, you can write the query like the following: INSERT INTO #__users (id, name, username, email, registerDate, params) VALUES '{{id}}','{{name}}','{{username}}','{{email}}','{{registerDate}}','{{params}}';
  • Click on Save button at last to create your Custom endpoint / REST API.

miniorange img How to use Created SQL POST 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.
  • Setup Custom SQL post
  • 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_post’.
    • 2) Then select the POST HTTP method.
    • 3) Pass id, name, username, email, registerDate, params in the body of request.
  • You will receive 1 in the response if data successfully entered in the table.
  • create Custom SQL POST API - successfully entered

miniorange img Configuration to create Custom SQL PUT API:

  • Navigate to Joomla Create SQL APIs tab and click on click here button.
  • 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 PUT 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 custom sql put method
  • Note: To send custom parameters, you can write the query like the following: UPDATE #__users set username='{{username}}' where id='{{id}}';
  • On Save button at last to create your Custom endpoint / REST API.

miniorange img How to use Created SQL PUT 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.
  • How to USE Created SQL PUT API- endpoints
  • To update 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_put’.
    • 2) Then select the PUT HTTP method.
    • 3) Pass username, id in the body of request or in the query parameter.
  • You will receive 1 in the response if data successfully entered in the table.
  • Joomla CustomAPI - PUT HTTP method

miniorange img Configuration to create Custom SQL DELETE API:

  • Navigate to Joomla Create SQL APIs tab and click on click here button.
  • 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 DELETE 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.
  • create Custom SQL DELETE API
  • Note: To send custom parameters, you can write the query like the following: DELETE FROM #__users WHERE id='{{id}}';
  • Click on Save button at last to create your Custom endpoint / REST API.

miniorange img How to use Created SQL DELETE 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.
  • How to USE Created SQL DELETE API
  • To delete 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_delete’.
    • 2) Then select the DELETE HTTP method.
    • 3) Pass id in the body of request or in the query parameter.
  • You will receive 1 in the response if data successfully entered in the table.
  • Setup Custom API for Joomla -DELETE HTTP method

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
Contact miniOrange Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com