No Code Attached Yet Information Required
avatar McTuska
McTuska
21 Mar 2025

Is your feature request related to a problem? Please describe.

Schemaorg cannot be update via API REST because plugin checks that you are on admin site or not.

Describe the solution you'd like

Update Schemaorg plugin check as
++ if ((!$app->isClient('administrator') & !$app->isClient('api') ) || !$this->isSupported($context))
instead of checking only admin site.

Additional context

Would help a lot automation process..

avatar McTuska McTuska - open - 21 Mar 2025
avatar joomla-cms-bot joomla-cms-bot - change - 21 Mar 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Mar 2025
avatar AdarshSantoria
AdarshSantoria - comment - 22 Mar 2025

Hi @McTuska,

I tested the Joomla REST API at /api/index.php/v1/content/articles/id using a PATCH request with a valid Bearer token and content-type application/json. The article was successfully updated via API, and the changes were reflected on the frontend.

So far, I haven’t encountered any issue updating via REST.

Your proposed solution:

if ((!$app->isClient('administrator') & !$app->isClient('api') ) || !$this->isSupported($context))

actually prevents both administrator and api clients from proceeding, which means only frontend (site) requests would be allowed. This defeats the purpose of enabling updates through the REST API.

Could you clarify what issue you're facing exactly? As of now, the current logic seems to be working as expected for API requests.

avatar QuyTon QuyTon - change - 24 Mar 2025
Labels Added: Information Required
avatar QuyTon QuyTon - labeled - 24 Mar 2025
avatar QuyTon QuyTon - change - 14 Apr 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-04-14 05:36:53
Closed_By QuyTon
avatar QuyTon QuyTon - close - 14 Apr 2025
avatar QuyTon
QuyTon - comment - 14 Apr 2025

Please test PR #45319. Thanks.

avatar Sanjana2906
Sanjana2906 - comment - 14 Apr 2025

@QuyTon I've tested the API endpoint locally and is working as expected with a successful 'curl' POST request (200 OK, created article ID 3). Let me know if you want me to check anything else in particular.

avatar McTuska
McTuska - comment - 14 Apr 2025

Hi,

I was trying put modified schema (Product) to website. It worked from admin
sie yes, but prevent make a query from api. There is return after that and
I thought this wants prevent call from from api..

Of course it can be wrong context but honestly it is little bit hard to
find info about that. All is just like copy paste demos.. 😀

Best R,
Mikko

la 22.3.2025 klo 15.39 Adarsh Santoria @.***) kirjoitti:

Hi @McTuska https://github.com/McTuska,

I tested the Joomla REST API at /api/index.php/v1/content/articles/id
using a PATCH request with a valid Bearer token and content-type
application/json. The article was successfully updated via API, and the
changes were reflected on the frontend.

So far, I haven’t encountered any issue updating via REST.

Your proposed solution:

if ((!$app->isClient('administrator') & !$app->isClient('api') ) || !$this->isSupported($context))

actually prevents both administrator and api clients from proceeding,
which means only frontend (site) requests would be allowed. This defeats
the purpose of enabling updates through the REST API.

Could you clarify what issue you're facing exactly? As of now, the current
logic seems to be working as expected for API requests.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBCXOJVVMZJIK57HHD2VVRX3AVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBVGI3TCNJVGY
.
You are receiving this because you were mentioned.Message ID:
@.***>
[image: AdarshSantoria]AdarshSantoria left a comment
(#45178)
#45178 (comment)

Hi @McTuska https://github.com/McTuska,

I tested the Joomla REST API at /api/index.php/v1/content/articles/id
using a PATCH request with a valid Bearer token and content-type
application/json. The article was successfully updated via API, and the
changes were reflected on the frontend.

So far, I haven’t encountered any issue updating via REST.

Your proposed solution:

if ((!$app->isClient('administrator') & !$app->isClient('api') ) || !$this->isSupported($context))

actually prevents both administrator and api clients from proceeding,
which means only frontend (site) requests would be allowed. This defeats
the purpose of enabling updates through the REST API.

Could you clarify what issue you're facing exactly? As of now, the current
logic seems to be working as expected for API requests.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBCXOJVVMZJIK57HHD2VVRX3AVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBVGI3TCNJVGY
.
You are receiving this because you were mentioned.Message ID:
@.***>

avatar McTuska
McTuska - comment - 14 Apr 2025

Hi again, I tried wrote something like this:
$schema=["schemaType"=>"Component",
"Component"=> [

@."=>"Product",
"image"=> $image
"name"=>($row['name']),
"description"=>$row['note'],
@.
"=>"Brand","name"=>"Mycompay"],
@.***"=>'Offer',
"price"=>$price,"priceCurrency"=>"EUR",
"availability"=>"https://schema.org/InStock",
"url"=>$url

]
];

But it do not want store to schema.org table because something is
preventing it.

la 22.3.2025 klo 15.39 Adarsh Santoria @.***) kirjoitti:

Hi @McTuska https://github.com/McTuska,

I tested the Joomla REST API at /api/index.php/v1/content/articles/id
using a PATCH request with a valid Bearer token and content-type
application/json. The article was successfully updated via API, and the
changes were reflected on the frontend.

So far, I haven’t encountered any issue updating via REST.

Your proposed solution:

if ((!$app->isClient('administrator') & !$app->isClient('api') ) || !$this->isSupported($context))

actually prevents both administrator and api clients from proceeding,
which means only frontend (site) requests would be allowed. This defeats
the purpose of enabling updates through the REST API.

Could you clarify what issue you're facing exactly? As of now, the current
logic seems to be working as expected for API requests.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBCXOJVVMZJIK57HHD2VVRX3AVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBVGI3TCNJVGY
.
You are receiving this because you were mentioned.Message ID:
@.***>
[image: AdarshSantoria]AdarshSantoria left a comment
(#45178)
#45178 (comment)

Hi @McTuska https://github.com/McTuska,

I tested the Joomla REST API at /api/index.php/v1/content/articles/id
using a PATCH request with a valid Bearer token and content-type
application/json. The article was successfully updated via API, and the
changes were reflected on the frontend.

So far, I haven’t encountered any issue updating via REST.

Your proposed solution:

if ((!$app->isClient('administrator') & !$app->isClient('api') ) || !$this->isSupported($context))

actually prevents both administrator and api clients from proceeding,
which means only frontend (site) requests would be allowed. This defeats
the purpose of enabling updates through the REST API.

Could you clarify what issue you're facing exactly? As of now, the current
logic seems to be working as expected for API requests.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBCXOJVVMZJIK57HHD2VVRX3AVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBVGI3TCNJVGY
.
You are receiving this because you were mentioned.Message ID:
@.***>

avatar Sanjana2906
Sanjana2906 - comment - 14 Apr 2025

Hi @McTuska , Thank you for testing and sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org plugin also works with Joomla API. From your message, it seems like the data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles endpoint to create or update the article? The plugin currently supports content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev branch, but created Pr against 5.3-dev since that's the active development branch now.
I'll be happy to take a closer look to help identify the issue.

avatar McTuska
McTuska - comment - 15 Apr 2025

Hi,

Moment, I have test again. I have created own component with api and
schemorg product plugin. That worked earlier with 5.2.5 version but
yesterday I installed 5.2.6 update. Now it seems that $data['schema'] field
is lost via api. It is in save before api->edit function. In
$form->process (in Form class) it somehow fails when filter. (it seems that
'schema' is not valid field anymore). I have no idea what mistake I have
now done.

ma 14.4.2025 klo 22.18 sanjana @.***) kirjoitti:

Hi @McTuska https://github.com/McTuska , Thank you for testing and
sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org
plugin also works with Joomla API. From your message, it seems like the
data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles
endpoint to create or update the article? The plugin currently supports
content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev
branch, but created Pr against 5.3-dev since that's the active development
branch now.
I'll be happy to take a closer look to help identify the issue.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBIG5UKELN2NUROBZT2ZQC2DAVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG43DKMRQGI
.
You are receiving this because you were mentioned.Message ID:
@.***>
Sanjana2906 left a comment (#45178)
#45178 (comment)

Hi @McTuska https://github.com/McTuska , Thank you for testing and
sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org
plugin also works with Joomla API. From your message, it seems like the
data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles
endpoint to create or update the article? The plugin currently supports
content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev
branch, but created Pr against 5.3-dev since that's the active development
branch now.
I'll be happy to take a closer look to help identify the issue.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBIG5UKELN2NUROBZT2ZQC2DAVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG43DKMRQGI
.
You are receiving this because you were mentioned.Message ID:
@.***>

avatar McTuska
McTuska - comment - 15 Apr 2025

Hi again,

I have no idea what I have done. After checking typos, only reasonable fix
that I can give schemaorg.php is:
public function onContentAfterSave(Model\AfterSaveEvent $event)
{
$context = $event->getContext();
$table = $event->getItem();
$isNew = $event->getIsNew();
$data = $event->getData();
$app = $this->getApplication();
$db = $this->getDatabase();

+if ((!$app->isClient('administrator') & !$app->isClient('api')) || !$this->
isSupported($context)) {
return;
}

Otherwise I have problems to pass this if clause. It seems that $context is
valid (return true).

ti 15.4.2025 klo 10.07 Mikko L @.***) kirjoitti:

Hi,

Moment, I have test again. I have created own component with api and
schemorg product plugin. That worked earlier with 5.2.5 version but
yesterday I installed 5.2.6 update. Now it seems that $data['schema'] field
is lost via api. It is in save before api->edit function. In
$form->process (in Form class) it somehow fails when filter. (it seems that
'schema' is not valid field anymore). I have no idea what mistake I have
now done.

ma 14.4.2025 klo 22.18 sanjana @.***) kirjoitti:

Hi @McTuska https://github.com/McTuska , Thank you for testing and
sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org
plugin also works with Joomla API. From your message, it seems like the
data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles
endpoint to create or update the article? The plugin currently supports
content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev
branch, but created Pr against 5.3-dev since that's the active development
branch now.
I'll be happy to take a closer look to help identify the issue.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBIG5UKELN2NUROBZT2ZQC2DAVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG43DKMRQGI
.
You are receiving this because you were mentioned.Message ID:
@.***>
Sanjana2906 left a comment (#45178)
#45178 (comment)

Hi @McTuska https://github.com/McTuska , Thank you for testing and
sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org
plugin also works with Joomla API. From your message, it seems like the
data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles
endpoint to create or update the article? The plugin currently supports
content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev
branch, but created Pr against 5.3-dev since that's the active development
branch now.
I'll be happy to take a closer look to help identify the issue.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBIG5UKELN2NUROBZT2ZQC2DAVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG43DKMRQGI
.
You are receiving this because you were mentioned.Message ID:
@.***>

avatar McTuska
McTuska - comment - 15 Apr 2025

Still hi,

Difference seems really to be that forms xml have to have a schema field
named in xml. Worked in 5.2.5 ok, but need to add the name xml now. Feature
?

ti 15.4.2025 klo 10.24 Mikko L @.***) kirjoitti:

Hi again,

I have no idea what I have done. After checking typos, only reasonable fix
that I can give schemaorg.php is:
public function onContentAfterSave(Model\AfterSaveEvent $event)
{
$context = $event->getContext();
$table = $event->getItem();
$isNew = $event->getIsNew();
$data = $event->getData();
$app = $this->getApplication();
$db = $this->getDatabase();

+if ((!$app->isClient('administrator') & !$app->isClient('api')) || !$this
->isSupported($context)) {
return;
}

Otherwise I have problems to pass this if clause. It seems that $context
is valid (return true).

ti 15.4.2025 klo 10.07 Mikko L @.***) kirjoitti:

Hi,

Moment, I have test again. I have created own component with api and
schemorg product plugin. That worked earlier with 5.2.5 version but
yesterday I installed 5.2.6 update. Now it seems that $data['schema'] field
is lost via api. It is in save before api->edit function. In
$form->process (in Form class) it somehow fails when filter. (it seems that
'schema' is not valid field anymore). I have no idea what mistake I have
now done.

ma 14.4.2025 klo 22.18 sanjana @.***) kirjoitti:

Hi @McTuska https://github.com/McTuska , Thank you for testing and
sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org
plugin also works with Joomla API. From your message, it seems like the
data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles
endpoint to create or update the article? The plugin currently supports
content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev
branch, but created Pr against 5.3-dev since that's the active development
branch now.
I'll be happy to take a closer look to help identify the issue.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBIG5UKELN2NUROBZT2ZQC2DAVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG43DKMRQGI
.
You are receiving this because you were mentioned.Message ID:
@.***>
Sanjana2906 left a comment (#45178)
#45178 (comment)

Hi @McTuska https://github.com/McTuska , Thank you for testing and
sharing the details.
Yes, the recent changes were specifically made to ensure the Schema.org
plugin also works with Joomla API. From your message, it seems like the
data isn't saved to the schema.org table when using your custom schema.
Could you confirm if you're using the /api/index.php/v1/content/articles
endpoint to create or update the article? The plugin currently supports
content passed via this standard endpoint.
Also, just to clarify : I originally developed the patch on the 5.2-dev
branch, but created Pr against 5.3-dev since that's the active development
branch now.
I'll be happy to take a closer look to help identify the issue.


Reply to this email directly, view it on GitHub
#45178 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BPQ7RUBIG5UKELN2NUROBZT2ZQC2DAVCNFSM6AAAAABZPK3TWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG43DKMRQGI
.
You are receiving this because you were mentioned.Message ID:
@.***>

avatar Sanjana2906
Sanjana2906 - comment - 15 Apr 2025

Hi @McTuska ,
Thank you for bringing this up! While I don't have in-depth knowledge about XML, I'm eager to learn more and collaborate to find solution.
In the meantime, I've complied comprehensive documentation that covers the necessary details, including payload and implementation for Schemaorg. You can check it out here: [https://github.com/joomla/joomla-cms/compare/5.3-dev...Sanjana2906:joomla-cms:schemaorg-doc-pr?expand=1#diff-431d327d47e0b4f79604cd2b0a778cac5d94376db392cde6f1e2aa16181316c2]

avatar richard67 richard67 - change - 20 May 2025
Status Closed New
Closed_Date 2025-04-14 05:36:53
Closed_By QuyTon
avatar richard67 richard67 - reopen - 20 May 2025
avatar richard67
richard67 - comment - 20 May 2025

Re-opening as PR #45319 has been closed.

Add a Comment

Login with GitHub to post a comment