Issues with Joomla Core APIs and Zapier Integration

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
User avatar
4creator
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Thu Sep 20, 2007 1:03 pm
Location: Japan
Contact:

Issues with Joomla Core APIs and Zapier Integration

Post by 4creator » Thu May 09, 2024 9:24 am

Hello,

I am currently experiencing issues when creating Joomla articles via POST in Webhooks by Zapier. Although the articles are created, they do not appear in the Joomla backend article list, and I receive errors. My investigation suggests there might be a bug where data is not being created in the #__workflow_associations table when articles are created through the API. If I manually add the item_id, the articles then appear in the backend list.

I am unsure whether this bug originates from the Joomla side or the Zapier side. I also suspect there might be an issue with my configuration, although I have not been able to identify any misconfigurations so far.

Is the current Joomla Core APIs supporting the workflow features introduced in Joomla 4?

For reference, I am using Joomla 4.4.4 with MySQL 8.0.37, PHP 8.1.28 on a LiteSpeed server.

Here are the specific error messages I am encountering:

Code: Select all

A PHP Exception occurred on your site. Here you can find the stack trace:
Exception Type: Joomla\CMS\MVC\Controller\Exception\Save
File: [Joomla Library Path]/libraries/src/MVC/Controller/ApiController.php
Line: 452
Message: Save failed with the following error: Error loading menu: api
#0 [Joomla Library Path]/libraries/src/MVC/Controller/ApiController.php(316): Joomla\CMS\MVC\Controller\ApiController->save()
...

Request information
GET variables: Array ( )
POST variables: Array ( )
COOKIE variables: Array ( )
REQUEST variables: Array ( )
SERVER variables: Array (
    [HTTP_ACCEPT] => */*
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [CONTENT_TYPE] => application/json; charset=utf-8
    [CONTENT_LENGTH] => 141
    [HTTP_USER_AGENT] => Zapier
    [DOCUMENT_ROOT] => [Document Root Path]
    [REQUEST_SCHEME] => https
    [REQUEST_URI] => /api/index.php/v1/content/articles
    [HTTPS] => on
    [SSL_PROTOCOL] => TLSv1.2
    [SSL_CIPHER] => ECDHE-RSA-AES128-GCM-SHA256
    [SSL_CIPHER_USEKEYSIZE] => 128
    [SSL_CIPHER_ALGKEYSIZE] => 128
    [SCRIPT_FILENAME] => [Document Root Path]/api/index.php
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_SOFTWARE] => LiteSpeed
    [REQUEST_METHOD] => POST
    [PHP_SELF] => /api/index.php/v1/content/articles
    [REQUEST_TIME_FLOAT] => [Timestamp]
    [REQUEST_TIME] => [Timestamp]
)
This is the API request being sent from Zapier:

Code: Select all

This is the API request being sent from Zapier:

[b]Post in Webhooks by Zapier[/b]
- [b]App & Event:[/b]
  - Webhook by Zapier
  - Event: POST
- [b]Action:[/b]
  - URL: [Document Root Path]/api/index.php/v1/content/articles
  - Payload Type: JSON
  - Data:
    - title: "Example Title"
    - catid: 179
    - state: 1
    - introtext: "{vimeo}ExampleID{/vimeo}"
    - created_by: [User ID]
    - language: "*"
    - alias: "example-title"
  - Wrap Request in Array: No
  - Basic Auth: [Redacted]
  - Headers: X-Joomla-Token
- [b]Test Steps:[/b]
  - Send Outbound Email in Email by Zapier
- [b]App & Event:[/b]
  - Email by Zapier
  - Event: Send Outbound Email
- [b]Action:[/b]
  - To: [Email Address]
  - Subject: "RNAJ: [Subject Text]"
  - Body: "[Body Text]"
  - From Name: "Example User Name"
  - Force Line Breaks: False
  - Enable Read Receipts: False
*This time, ChatGPT provided the translation.
Last edited by imanickam on Tue May 14, 2024 5:39 am, edited 1 time in total.
Reason: Moved topic » from General Questions/New to Joomla! 4.x to Joomla! 4.x Coding
Many of my posts have been translated from Japanese by DeepL or ChatGPT. As such, it may contain mistranslations. :-[

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 31086
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Issues with Joomla Core APIs and Zapier Integration

Post by Per Yngve Berg » Thu May 09, 2024 11:01 am

The API is appearntly for J3. Workflow was a new feature in J4.0

User avatar
4creator
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Thu Sep 20, 2007 1:03 pm
Location: Japan
Contact:

Re: Issues with Joomla Core APIs and Zapier Integration

Post by 4creator » Thu May 09, 2024 12:10 pm

From the following article, I had interpreted the API as being Joomla 4 compatible:
https://docs.joomla.org/J4.x:Joomla_Core_APIs

Could you please clarify if there are specific parts of the API that do not support the workflow features introduced in Joomla 4? I am particularly interested in ensuring full compatibility and would appreciate any additional insights or corrections you might have regarding the API’s capabilities in Joomla 4.

Thank you for your assistance!
Many of my posts have been translated from Japanese by DeepL or ChatGPT. As such, it may contain mistranslations. :-[

snkai
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Apr 19, 2024 9:52 am

Re: Issues with Joomla Core APIs and Zapier Integration

Post by snkai » Fri May 10, 2024 12:25 pm

i have pretty the same issue here by calling the API from make.com

User avatar
4creator
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Thu Sep 20, 2007 1:03 pm
Location: Japan
Contact:

Investigation and Request for Resolution on Potential Bugs in Joomla Core APIs

Post by 4creator » Tue May 14, 2024 1:16 am

Hello everyone,

I am using Joomla 4.x and automating article creation through Zapier's Webhooks. However, I am facing the following technical issues and am seeking solutions.

Detailed Problem Description:
Zapier's webhook sends POST requests to [Document Root Path]/api/index.php/v1/content/articles, which are processed by Joomla Core APIs. Although articles are created, they do not appear in Joomla's backend, and the following error messages are reported each time.
  • Error mail from the server: "Unhandled exception - Joomla\CMS\MVC\Controller\Exception\Save" with the error details "Exception Type: Joomla\CMS\MVC\Controller\Exception\Save
    File: /home/XXXX/public_html/libraries/src/MVC/Controller/ApiController.php
    Line: 452
    Message: Save failed with the following error: Error loading menu: api"
  • Alert mail from Zapier: "[ALERT] Possible error on your PDF Upload Zap!" with the error details "Save failed with the following error: Error loading menu: api (HTTP Status Code: 500)"
My investigations suggest that the root cause might be the insufficient data insertion into the #__workflow_associations table. I suspect this could be a bug in the Joomla Core APIs, and I am currently manually correcting the table as a temporary measure.

Questions:
  • Have other users experienced similar issues? (Thanks for the report, snkai!)
  • Is the development team aware of this problem, and are there any planned fixes or workarounds?
I would appreciate hearing about your experiences or suggestions. Resolving this issue will require the community's effort. Thank you for your cooperation.
Many of my posts have been translated from Japanese by DeepL or ChatGPT. As such, it may contain mistranslations. :-[

User avatar
4creator
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Thu Sep 20, 2007 1:03 pm
Location: Japan
Contact:

Re: Issues with Joomla Core APIs and Zapier Integration

Post by 4creator » Wed May 15, 2024 1:52 am

I reviewed the Joomla Core APIs documentation and noticed that I had set introtext instead of articletext in my Zapier configuration.

I changed the Zapier settings and re-tested. The following error message was displayed in Zapier:
Failed to create a request in Webhooks by Zapier
Call to undefined method Joomla\CMS\Router\ApiRouter::build() (HTTP Status Code: 500)
Upon checking, I found new records in #__content (with data in introtext) and #__assets, but no new records in #__workflow_associations.

Therefore, the issue is not caused by using introtext instead of articletext. I conclude that the API is not following Joomla 4's new workflow feature, causing the error.
Many of my posts have been translated from Japanese by DeepL or ChatGPT. As such, it may contain mistranslations. :-[

User avatar
4creator
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Thu Sep 20, 2007 1:03 pm
Location: Japan
Contact:

Re: Issues with Joomla Core APIs and Zapier Integration

Post by 4creator » Fri May 17, 2024 9:51 am

I have encountered an issue with the Joomla 4 API where it is attempting to reference a directory structure that no longer exists in Joomla 4. Specifically, the error "View not found [name, type, prefix]: articles, html, api" occurs because the API is trying to access components/com_content/views/articles, which is not present in Joomla 4.

In Joomla 3, this directory existed, but Joomla 4 has undergone significant structural changes, and this path is no longer valid. This discrepancy seems to be causing the API to fail when attempting to locate the specified view.

For now, I am leaving this error as is and waiting for feedback from the Joomla development team. However, I believe it's important to highlight this issue for other users who might be facing the same problem.

Thank you for your assistance and I look forward to any guidance or updates from the Joomla developers regarding this matter.
Many of my posts have been translated from Japanese by DeepL or ChatGPT. As such, it may contain mistranslations. :-[

User avatar
4creator
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Thu Sep 20, 2007 1:03 pm
Location: Japan
Contact:

Re: Issues with Joomla Core APIs and Zapier Integration

Post by 4creator » Fri May 24, 2024 12:42 am

Progress Report:

I have some updates to share. One of the data elements passed to Zapier included the filename of the file uploaded from the form. This filename might originally have been in Japanese before the upload, and the form program converts the filename to alphanumeric characters during the upload.

It seems there was an issue with this conversion method, and after changing the conversion method and passing the data to Zapier, the nature of the error changed.

Previously, the following error was encountered:

Code: Select all

Exception Type: Joomla\CMS\MVC\Controller\Exception\Save
File: /home/XXX/public_html/libraries/src/MVC/Controller/ApiController.php
Line: 452
Message: Save failed with the following error: Error loading menu: api
After changing the filename conversion method, the error changed to:

Code: Select all

Exception Type: RuntimeException
File: /home/XXX/public_html/libraries/src/MVC/Controller/ApiController.php
Line: 154
Message: View not found [name, type, prefix]: articles, html, api
Since this error change, when a Joomla article is created via the API, the article can now be confirmed in the backend as well. Data is also being created in the #__workflow_associations table.

It seems the issue I reported earlier, where data was not being created in the #__workflow_associations table, was not due to Joomla Core APIs but rather due to the filename conversion method.

However, despite the change in the nature of the error, the HTTP Status Code: 500 error persists, so it is still important to monitor the possibility that there might be a bug in the Joomla Core APIs.
Many of my posts have been translated from Japanese by DeepL or ChatGPT. As such, it may contain mistranslations. :-[


Post Reply

Return to “Joomla! 4.x Coding”