Alex.
Contact Me
A l e x
Jiji, your new Joomla! 4 Console friend
Jiji, your new Joomla! 4 Console friend

API CONSOLE - Jiji, your new Joomla! 4 Console friend

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Also available: Français (Fr)
Last Updated: 19 August 2023
Hits: 3136

System - Jiji

Jiji is a System Plugin leveraging the Joomla! 4 Web Services by adding custom actions to core Joomla! console without “hacks” using DI Container and other Joomla! 4 advanced capabilities.
Edit: After searching later on the web I found out that Chris Davenport already did something similar I think for Joomla 3 at that time. Joomla 4 didn't exists yet.

WHY ?

I started Jiji back in December 2020 because at that time I wanted some kind of proof of concept, a toy project to try out the new Joomla! 4 console which is based on Symfony Console. If you already know Symfony Console you will be at home with Joomla! 4 Console.

WHAT ?

“Jiji” name comes from what I thought might be a “cute girl” name based on a short nickname version of our beloved “Joomla!” which is a trademark of Open Source Matters by the way.

HOW ?

Jiji is a System Plugin which “adds” or “registers” new commands to the default joomla console cli script JPATH_ROOT/cli/joomla.php
I could create my own console script for that named JPATH_ROOT/cli/jiji.php but I thought it might be better to have only one entrypoint for joomla cli which make it easier to remember. You will tell me if I am wrong. Willing to hear your feedback on that.

The “Jiji” code is in a Library placed in the src directory inside the plugin.
it is namespaced as AE\Library\Jiji . Namespace are available since PHP 5.3
The Behavior directory holds all the PHP Traits used by the Plugin. Traits are available since PHP 5.4. Basically, they are common behaviors used in unrelated Php Classes. In other words, when you find yourself copy/pasting again and again a functionality from one Class to another, it might be a good candidate for a Trait.
The heart of this plugin is in the AE\Library\Jiji\Console namespace. Is the corresponding directory you will find my first Console Command named HelloSuperJoomlerCommand.php which just says “Hello Super Joomler”. But another directory more interesting is Article directory where are all Article related Commands.

  • GET all articles (Browse)
  • GET one article by id (Read)
  • PATCH one article by id (Edit)
  • POST one article by id (Add)
  • DELETE one article by id (Delete)

In order to DELETE you must first do a PATCH with at minimum the category id , the title and the state as -2 of the article you want to DELETE.
Example JSON payload: ‘{“catid”:64, “title”:“My edited title”, “state”:-2}’
“Jiji” can use a JSON file or JSON string as payload for your requests containing a body.

INSTRUCTIONS:

1 - The extension zip is in the build/ directory of this GitHub repository

2 - Install the Jiji plugin as any other Joomla! 4 extension.

3 - Follow these instructions

JPATH_ROOT : the root directory of your Joomla 4 website. Change this with the relevant directory absolute path

J4X_BASE_PATH : Your Joomla! 4 Base Url (eg: https://example.com)

J4X_API_TOKEN : Your Joomla! 4 API Token

You can use it non-interactive by adding the -n

Execute the basic Command Hello Super Joomler

  
php JPATH_ROOT/cli/joomla.php jiji:hello  
  

Execute the Browse Article Command

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:browse  
  

Execute the Read Article Command (eg: id=1)

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:read --id=1  
  

Execute the Add Article Command

using a JSON string as payload

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:add --item-data='{"alias": "my-article","articletext": "My text","catid": 64,"language": "*","metadesc": "","metakey": "","title": "Here's an article"}'  
  

or more conveniently using a JSON file as payload

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:add --item-data='path/to/add-article.json'  
  

Execute the Edit Article Command (eg: id=1)

using a JSON string as payload

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:edit --id=1 --item-data='{"catid": 64,"title": "Here's an another article"}'  
  

or more conveniently using a JSON file as payload

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:edit --id=1 --item-data='path/to/edit-article.json'  
  

Execute the Delete Article Command (eg: id=1)

This must be done in two steps due to this new way to do it

1 - Execute the Edit Article Command on the article you want to delete by change it’s state to -2 (Trash)

2 - Execute the Delete Article Command on the article you want to delete.

Step 1 for Deleting Article

using a JSON string as payload

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:edit --id=1 --item-data='{"catid": 64,"title": "Here's an another article", "state": -2}'  
  

or more conveniently using a JSON file as payload

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:edit --id=1  --item-data='path/to/delete-step-1-article.json'  
  

Step 2 Deleting Article

  
php JPATH_ROOT/cli/joomla.php -n --base-path=J4X_BASE_PATH --api-token=J4X_API_TOKEN article:delete --id=1  
  

CONTRIBUTORS

Contributors are welcomed to jump in and help improve this project. Any constructive feedback is welcomed.

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

Helloapi webservice composant Joomla 4
Photo on Unsplash

EXTENSION - Helloapi example component Joomla! 4 webservices

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Also available: Français (Fr)
Last Updated: 29 September 2023
Hits: 2536

Example of basic Joomla! 4 component implementing webservices in Joomla! 4

Works with curl, Guzzle, Postman and other HTTP clients

 Download Component Helloapi
 Download Plugin Helloapi
  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    You can:

    • Contact me
    • Subscribe to daily technical newsletter about Joomla (daily at 9h00 A.M UTC +00:00)
    • Add a star to the project that helped you the most. Sharing is caring.

Should Joomla! tend to become an unopiniated headless CMS? Maybe in Joomla! 4.5?
Photo from Unsplash

SUGGESTION - Should Joomla! tend to become an unopiniated headless CMS? Maybe in Joomla! 4.5?

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Also available: Français (Fr)
Last Updated: 19 August 2023
Hits: 2438

I more or less recently stumbled upon the "headless CMS" thing where the actual content is completely separated from the actions one can do to "manipulate" or "act on" the content using an API. I know that Webservices are coming in Joomla 4 hopefully. But I was wondering if a full fledge "headless CMS" might be the way to go to help Joomla! become popular again to more developers. To me, If more developers do more stuff for Joomla! core and contribute, the whole Joomla community will benefit from it. 

Read more: SUGGESTION - Should Joomla! tend to become an unopiniated headless CMS? Maybe...

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    You can:

    • Contact me
    • Subscribe to daily technical newsletter about Joomla (daily at 9h00 A.M UTC +00:00)
    • Add a star to the project that helped you the most. Sharing is caring.

Photo by Behzad Ghaffarian on Unsplash

ANNOUNCEMENT - Smart POST or PATCH Joomla! articles via API code example 200loc pure PHP

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 634
The first announcement, few days ago was about Joomla! Web Services practical code examples with pure php or with Joomla! Framework. If you missed it, here it is

Today, it's about a major improvement of the samples, in particular POST and PATCH. It enhance the developer experience in about 200 lines of pure PHP.

Here it is:

Read more: ANNOUNCEMENT - Smart POST or PATCH Joomla! articles via API code example...

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    You can:

    • Contact me
    • Subscribe to daily technical newsletter about Joomla (daily at 9h00 A.M UTC +00:00)
    • Add a star to the project that helped you the most. Sharing is caring.

Photo by Milad Fakurian on Unsplash

ANNOUNCEMENT - New Features Added Support For Subform Custom Fields To Smart POST / PATCH Joomla! 4.x Api example

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 528
The second announcement, yesterday was about Smart POST / PATCH enhancement 200 lines of code Joomla! 4.x Api example. If you missed it, here it is

With this version of the Smart POST / PATCH php script, you can now:
  • POST / PATCH Existing subform custom field using csv url
  • POST / PATCH Images (intro image and fulltext image)
  • POST / PATCH Urls (urla,urlb,urlc)

Here it is:

Read more: ANNOUNCEMENT - New Features Added Support For Subform Custom Fields To Smart...

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

Photo by Rohit Choudhari on Unsplash

ANNOUNCEMENT - Now you can use one line api to sync multiple articles from Airtable Api to multiple Joomla! sites at once

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 460
  • challenge
Hello Super Joomlers!
Now you can use one line api to sync multiple articles from Airtable Api to multiple Joomla! sites at once with a single self-contained php script leveraging Joomla! Web Services.

Here is the screenshot of the result:

Read more: ANNOUNCEMENT - Now you can use one line api to sync multiple articles from...

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

Photo by Tim Mossholder on Unsplash

API EXAMPLE - Joomla! 4.x Web Services and GitHub GraphQL API

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 455
Hello Super Joomlers!

Today we are playing with GraphQL. Mashing up Joomla! Web Services with the power of Giants like the GitHub GraphQL API.
You can now do all that using a single self-contained php script in about 300loc.

Here is the screenshot of the result:

Read more: API EXAMPLE - Joomla! 4.x Web Services and GitHub GraphQL API

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

Photo by Shubham Dhage on Unsplash

ANNOUNCEMENT - Now you can use one line api to sync multiple articles from a csv url to multiple Joomla! sites at once

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 424
  • challenge
Now you can use one line api to sync multiple articles from a single public csv url to multiple Joomla! sites at once using a single self-contained php script .

Here is the screenshot of the result:

Read more: ANNOUNCEMENT - Now you can use one line api to sync multiple articles from a...

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

Photo by Christian Wiediger on Unsplash

API EXAMPLE - Fetch Your Top 5 Favorite Movies with Joomla! 4.x Web Services and OMDb Movie Api

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 363
Hello Super Joomlers!

Today we are trying OMDb Movie Api. Mashing up Joomla! Web Services with OMDb The Open Movie Database Api
Fetch your favorite movies and turn them into a Joomla! article. Don't forget to delete the articles when you see the demo working as expected.
Our intention here is not to scrape the whole internet but to showcase what is possible with Joomla! Web Services mashup.
You can now do all that using a single self-contained php script in about 300loc.

Here is the screenshot of the result:

Read more: API EXAMPLE - Fetch Your Top 5 Favorite Movies with Joomla! 4.x Web Services...

  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

Photo by Karla Hernandez on Unsplash

ANNOUNCEMENT - Joomla! 4.x Web Services Api Code Examples Solving Common Scenarios

Details
Written by: Mr Alexandre J-S William ELISÉ
Category: Blog
Last Updated: 19 August 2023
Hits: 338
For ready-to-use, commented, short Joomla! Web Services Api code solving common use cases, here is the repo:

If you are a Joomla! developer or want to become a Joomla! developer there is a new resource for you The Official New Joomla! Manual

If you are eager to learn more about Joomla! Web Services and want to play around with them using ready to use short examples, sample code and experiments this repo is for you. The examples are intentionally short with comments and for common scenarios and use cases. So even a non-developer could follow along.

If this code is useful to you, spread the Joomla! love and give it a star on GitHub: Star
  • About the author:

    Hi! Alex here,

    Joomla Developer since 2009, focused on Web Services since 2017,

    first in Joomla! 3 with jBackend and com_api

    More recently Web Services in Joomla! 4.x core.

    I like paperback format books, challenging projects and defensive cybersecurity "Blue Team".

    That's all for now. Have a delightful day.

  1. I.R.M - Insidious Request Morphing

Page 1 of 2

  • 1
  • 2

Subscribe Now For Free

Please fill in this field
    Please fill in this field
    Please fill in this field
    I agree with the Terms and conditions
    ×
    and the Privacy policy
    ×
    Alex | Api Adept

    Your Website. Augmented.

    Get in touch
    • Contributions
    • Conference Room
    • Leave a message
    Useful Links
    • Login
    • My account
    • Personal Data Request
    • Confirm Personal Data Request
    • Extend Your Consent

    Select your language

    • Français (Fr) FR
    • English (UK) EN
    Our Address
    FRANCE

    Copyright © 2023 Alex | Api Adept. All Rights Reserved.
    • General Sales Terms And Conditions
    • General Terms Of Use
    • Legal Notice
    • License for extensions created for Joomla (AGPL-3.0-or-later)
    • Privacy Policy And Cookies
    Oooh...

    Leaving already?

    Contact Continue