Feature PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar Sanjana2906
Sanjana2906
14 Apr 2025

Pull Request for Issue #45178.

Summary of Changes

This PR updates the Schemaorg system plugin to allow it to be executed when content is saved via API client, in addition to administrator client. This enables schema metadata to be processed properly for content created or updated through Joomla's REST API.

Testing Instructions

Enable the Schemaorg plugin in the backend.
Use Joomla REST API to create or update an article.
Check if schema metadata is generated or excepted.
Verify that the plugin continues to work correctly in the admin interface as before.

Actual result BEFORE applying this Pull Request

Schemaorg plugin does not execute when content is saved via API.

Expected result AFTER applying this Pull Request

Schemaorg plugin supports execution via both admin and API clients.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar Sanjana2906 Sanjana2906 - open - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 14 Apr 2025
Category Front End Plugins
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar QuyTon QuyTon - change - 14 Apr 2025
The description was changed
avatar QuyTon QuyTon - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
The description was changed
avatar Sanjana2906 Sanjana2906 - edited - 14 Apr 2025
avatar richard67
richard67 - comment - 14 Apr 2025

@Sanjana2906 The title of your PR starts with "[5.3]", but you have made the PR for the 5.2-dev branch.

As there will not be any further 5.2.x release, and 5.3.0 will be the next: Could you rebase your PR to the 5.3-dev branch?

If you are not sure how to do that, let me know, then I can do that.

Thanks in advance.

avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
Labels Added: PR-5.2-dev
avatar richard67
richard67 - comment - 14 Apr 2025

@Sanjana2906 Thanks for rebasing. Unfortunately you have also pished your .htaccess file. Could you revert that?

avatar Sanjana2906 Sanjana2906 - change - 14 Apr 2025
Labels Added: PR-5.3-dev
avatar Sanjana2906
Sanjana2906 - comment - 14 Apr 2025

@richard67 Thanks for the review! I've reverted the '.htaccess' commits . The branch is now synced with '5.3-dev' .

avatar richard67
richard67 - comment - 14 Apr 2025

@richard67 Thanks for the review! I've reverted the '.htaccess' commits . The branch is now synced with '5.3-dev' .

@Sanjana2906 Now you deleted the htaccess.txt file. Could you revert that, too? Your PR should show only the desired changes here: https://github.com/joomla/joomla-cms/pull/45319/files

avatar Sanjana2906
Sanjana2906 - comment - 14 Apr 2025

@brianteeman Appreciate the link- that was helpful, Thank you!

avatar richard67
richard67 - comment - 14 Apr 2025

@Sanjana2906 Thanks. PR looks good now.

avatar Sanjana2906
Sanjana2906 - comment - 14 Apr 2025

@richard67 Thanks for catching that! I've reverted the accidental deletion of 'htaccess.txt' and restored it from '5.3-dev'. The PR now only includes schema.org API support changes.

avatar alikon
alikon - comment - 14 Apr 2025

can you please document what the payload should be ? for POST/PATCH/GET the schemaorg

avatar Sanjana2906
Sanjana2906 - comment - 15 Apr 2025

@alikon
I've compiled comprehensive documentation covering the payload for POST, PATCH and, GET requests . You can find the full detail here: [ https://github.com/joomla/joomla-cms/compare/5.3-dev...Sanjana2906:joomla-cms:schemaorg-doc-pr?expand=1#diff-431d327d47e0b4f79604cd2b0a778cac5d94376db392cde6f1e2aa16181316c2 ] .
Thank you for the feedback.

avatar alikon
alikon - comment - 15 Apr 2025

with this pr
i've POSTed an article with the following payload

{
    "title" : "Test Article",
    "catid": 2,
    "language": "*",
    "@type" : "Article",
    "articletext" : "Content",
    "author": {
       "type" : "Person",
       "name" : "John-doe",
       "email" : "john@example.com"
    }
  }

but when i execute the GET

{
    "links": {
        "self": "http://localhost/530/api/index.php/v1/content/articles/107"
    },
    "data": {
        "type": "articles",
        "id": "107",
        "attributes": {
            "typeAlias": "com_content.article",
            "id": 107,
            "asset_id": 168,
            "title": "Test Article",
            "alias": "test-article",
            "state": 0,
            "created": "2025-04-15 12:54:59",
            "created_by": 506,
            "created_by_alias": "",
            "modified": "2025-04-15 12:54:59",
            "modified_by": 506,
            "publish_up": null,
            "publish_down": null,
            "images": [],
            "urls": [],
            "version": 1,
            "metakey": "",
            "metadesc": "",
            "access": 1,
            "hits": 0,
            "metadata": [],
            "featured": 0,
            "language": "*",
            "note": "",
            "tags": [],
            "featured_up": null,
            "featured_down": null,
            "text": "Content "
        },
        "relationships": {
            "category": {
                "data": {
                    "type": "categories",
                    "id": "2"
                }
            },
            "created_by": {
                "data": {
                    "type": "users",
                    "id": "506"
                }
            },
            "tags": {
                "data": []
            },
            "modified_by": {
                "data": {
                    "type": "users",
                    "id": "506"
                }
            }
        }
    }
}

i don't see any schemaorg related data , all the schemaorg plugins are enabled

avatar Sanjana2906
Sanjana2906 - comment - 15 Apr 2025

Hi @alikon ,
Thanks for testing and for the detailed observation.
You're right - currently the structured data ( Schema.org ) is successfully handled during the POST, but it's not yet returned in the GET response. This is because Joomla's core API doesn't automatically include plugin metadata unless we explicitly inject it into the response. I'll extend the implementation to include that by injecting the data during API response generation.
Appreciate you pointing that out - I'll follow up with the necessary changes.

avatar HLeithner HLeithner - change - 15 Apr 2025
Title
[5.3]Enable Schemaorg plugin support via API
[5.3] Enable Schemaorg plugin support via API
avatar HLeithner HLeithner - edited - 15 Apr 2025
avatar HLeithner HLeithner - change - 17 Apr 2025
Title
[5.3] Enable Schemaorg plugin support via API
[6.0] Enable Schemaorg plugin support via API
avatar HLeithner HLeithner - edited - 17 Apr 2025
avatar HLeithner
HLeithner - comment - 17 Apr 2025

I rebased this feature pr against 6.0, also please remove the documentation from the pr and create an entry in manual.joomla.org (since we don't have a clean documentation for api in the manual yet please add it to this section.

I also changed the pr to draft till it's complete

avatar Sanjana2906
Sanjana2906 - comment - 17 Apr 2025

I'll be drafting the updated API documentation and adding it to Joomla Manual by tomorrow. Please let me know if there are specific guidelines or details you'd like me to include.

avatar Sanjana2906
Sanjana2906 - comment - 18 Apr 2025

Hi @HLeithner, @alikon,

Thanks for the feedback and for moving the PR to 6.0-dev. I've written the documentation under docs/webservices/schemaorg-api-support.md as suggested — feel free to let me know if the placement looks okay.

I’ve also tested again by POSTing an article with the schema.org metadata, but I’m still not seeing any schema data returned in the GET response. The Schemaorg plugins are all enabled, but it doesn’t seem like they’re being triggered.

I’ve tried using the onAfterApiData event to inject the structured data, but I’m not fully sure if that’s the best or only way — would appreciate a little guidance if I’m missing something here.

Thanks again for your help and for reviewing the PR.

avatar Sanjana2906
Sanjana2906 - comment - 20 Apr 2025

Hi,
I'm working on a system plugin that implements onAfterApiData method to modify Joomla Web Services API response by adding Schema.org structured data.

Here's what I've confirmed:
The plugin is enabled in the Joomla admin.
The method onAfterApiData is defined in the plugin class.
I'm making GET requests and added debug logging at the beginning of the method, but the log file is never created.
It seems like the onAfterApiData method is not executed. Is there anything specific that must be one to be recognized in a system plugin?
Any help would be appreciated!

avatar richard67 richard67 - change - 28 Apr 2025
Labels Added: Feature PR-6.0-dev
Removed: PR-5.2-dev PR-5.3-dev
avatar richard67 richard67 - change - 28 Apr 2025
Build 5.2-dev 6.0-dev
avatar Bodge-IT
Bodge-IT - comment - 19 May 2025

@Sanjana2906 hi, is this PR still relevant or are you working on an alternative?

avatar Sanjana2906
Sanjana2906 - comment - 20 May 2025

Hi @Bodge-IT, thanks for checking. I gave it my best shot, but I wasn’t able to find a working solution, so I’ll close this PR for now. Appreciate the review and feedback!

avatar Sanjana2906 Sanjana2906 - change - 20 May 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-05-20 02:13:19
Closed_By Sanjana2906
avatar Sanjana2906 Sanjana2906 - close - 20 May 2025
avatar brianteeman
brianteeman - comment - 20 May 2025

Please re-open #45178

avatar Sanjana2906 Sanjana2906 - change - 22 May 2025
Status Closed New
Closed_Date 2025-05-20 02:13:19
Closed_By Sanjana2906
avatar Sanjana2906 Sanjana2906 - change - 22 May 2025
Status New Pending
avatar Sanjana2906 Sanjana2906 - reopen - 22 May 2025

Add a Comment

Login with GitHub to post a comment