Joomla 4 API Introduction – Manage Articles via Joomla API

In this tutorial we’ll take a look at the Joomla 4 API and Access Joomla 4 content (Articles via API).

The tutorial includes coding samples (using PHP and CURL) and Postman environment to easily set it up on your end. For more information, visit the detailed Joomla 4 API documentation here.

Remember to Replace {{base_path}} with your Joomla 4 installation url without trailing slash.

Accessing all Joomla Articles

Let’s go ahead and try to fetch a list of all articles using the API, It’s actually pretty straight forward, all you need to do is a GET request at the following url below and include your Joomla super admin username & password in the Auth Credentials and you’ll get all the Joomla articles of your website.

Request

Request type: GET

{{base_path}}/api/index.php/v1/content/article

Code for the request:

Depending on the number of articles you have the response you’ll have will be similar to:

Response

The response is standard json and you can do json_decode to access the response as an object. The response supports pagination so if you have a good amount of articles on your joomla site, you’ll be able to navigate pretty easily within the API and access all the articles without pushing your server limits.

Accessing a single Article

Now that we have the list of articles, we can access just a single article via API based on the article ID.

Request

Request type: GET

Replace {{article_id}} with the ID of the article you want to access.

{{base_path}}/api/index.php/v1/content/article/{{article_id}}

Code for the request:

The response gets you the API link to the article, along with the article creation date, category ID, tags, publishing status & description to list a few.

Response

Creating a new article

Joomla 4 API also allows us to create articles, in this example we’ll try creating one.

Request

Request type: POST

Since we are creating a article, we need to provide information about the article we want to create including but not limited to alias (must be unique), aritlcetext, introtext (Must provide either introtext or articletext), catid, language(required) (default *), metadesc (required) (default blank), metakey(required) (default blank) & title (required) .

By default, newly created articles are in unpublished state.

{{base_path}}/api/index.php/v1/content/article

Code for the request:

You get a response similar to the one from the last request where we tried to access an article by ID via the API.

Response

Deleting a article

We can also delete article(s) via API

Request

Request type: DELETE

A delete request online requires the article ID (like the single article request above).

{{base_path}}/api/index.php/v1/content/article/{{article_id}}

Code for the request:

Response

The delete request doesn’t return a response but a HTTP 204, which means okay but no content.

You can download the Postman Collection here

Watch Video Tutorial to Import and Setup Postman Collection and Environment

Naveen
Naveen is a versatile professional with expertise in Product Management, Marketing, QA, and Client Management. He brings a strategic approach to his work, combining technical insights with creative problem-solving to drive impactful outcomes. Outside of work, Naveen enjoys writing poetry and traveling, finding inspiration in words, cultures, and new experiences.