4.0.9 api create error

Please report bugs here!

Moderator: Thorsten

Post Reply
makoto
Posts: 6
Joined: Wed Jul 09, 2025 5:21 am

4.0.9 api create error

Post by makoto »

I have installed version 4.0.9 of phpmyfaq.
When I tried to register a QA using the create API, I got an error.
I got a typeerror message saying that the faqid must be of type INT.
Since I haven't specified the faqid as an API parameter, I feel like the data isn't being passed correctly during processing.

curl -X 'POST' \
'https://localhost/api/v3.0/faq/create' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"language": "de",
"category-id": 1,
"category-name": "Queen Songs",
"question": "Is this the world we created?",
"answer": "What did we do it for, is this the world we invaded, against the law, so it seems in the end, is this what we'\''re all living for today",
"keywords": "phpMyFAQ, FAQ, Foo, Bar",
"author": "Freddie Mercury",
"email": "freddie.mercury@example.org",
"is-active": "true",
"is-sticky": "false"
}'
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 4.0.9 api create error

Post by Thorsten »

Hi,

did you add the PMF API Token in the header?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 4.0.9 api create error

Post by Thorsten »

Hi,

I found the issue, it'll be fixed with 4.0.10

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
makoto
Posts: 6
Joined: Wed Jul 09, 2025 5:21 am

Re: 4.0.9 api create error

Post by makoto »

Thank you as always.

I tried replacing the FaqController.php that was revised in version 4.0.10 in a 4.0.9 environment.
Executing the API CREATE was successful.
However, the registered FAQ could not be accessed via API GET.

I logged in as an administrator and confirmed that the FAQ was registered in Record Management on the Content Management screen.
I selected Publish on this screen and saved it, and then I was able to access it via API GET.
Is this working as intended?

I was hoping that I would be able to publish the FAQ with API CREATE.
Perhaps reinstalling 4.0.10 will result in the expected behavior?
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 4.0.9 api create error

Post by Thorsten »

Hi,

did you enable the auto activition in the admin configuration?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
makoto
Posts: 6
Joined: Wed Jul 09, 2025 5:21 am

Re: 4.0.9 api create error

Post by makoto »

Thanks for your reply.

Where can I find the automatic activation settings?
If there is a settings manual, I will refer to it, so please let me know where it is.

I logged in as an administrator and looked through the preferences screen, but I couldn't find the relevant setting.
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 4.0.9 api create error

Post by Thorsten »

Hi,

it's in the admin section under Configuration -> FAQs -> Automatically activate new records:
Bildschirmfoto 2025-08-08 um 18.21.29.png
bye
Thorsten
You do not have the required permissions to view the files attached to this post.
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
makoto
Posts: 6
Joined: Wed Jul 09, 2025 5:21 am

Re: 4.0.9 api create error

Post by makoto »

Thank you. So it was a setting item here. I overlooked it.
I have already enabled it.
However, the FAQ records I registered automatically using the API create function were not published.
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 4.0.9 api create error

Post by Thorsten »

Hi,

I'll check the issue!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply