No Code Attached Yet Information Required
avatar JulianR-HR
JulianR-HR
3 Feb 2022

Hi,

as written in the subject, creating an article via the API with a POST on on the /content/article endpoint does not work.

Steps to reproduce the issue

  • Enable the API Authentication for a user which is allowed to create articles (superuser in my case)
  • try to create an article:
    ** myurl.com/api/index.php/v1/content/article** with the following body:
    {
    "alias": "my-article",
    "articletext": "My text",
    "catid": 64,
    "language": "*",
    "metadesc": "",
    "metakey": "",
    "title": "Here's an article",
    "condition": 1
    }

Expected result

Status 200

Actual result

404 File not found

System information (as much as possible)

PHP 7.4
Joomla 4.0.6

Additional comments

GET-Requests against the API are working perfect.

Votes

# of Users Experiencing Issue
0/1
Average Importance Score
5.00

avatar JulianR-HR JulianR-HR - open - 3 Feb 2022
avatar JulianR-HR JulianR-HR - change - 3 Feb 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 3 Feb 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Feb 2022
avatar zero-24
zero-24 - comment - 3 Feb 2022
avatar JulianR-HR
JulianR-HR - comment - 3 Feb 2022

I did, but then I receive the next error:

{ "errors": [ { "title": "Field required: Title\nField required: Category" } ] }

I think this does still not work as it should...


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36931.

avatar zero-24
zero-24 - comment - 3 Feb 2022

Well its the correct post URL for now. I have not implemented the API myself yet but you can have a look at the tests how it should work: https://github.com/joomla/joomla-cms/blob/4.1-dev/tests/Codeception/api/com_content/ContentCest.php

avatar Quy
Quy - comment - 3 Feb 2022

Please read the doc for required properties. You are missing catid.
https://docs.joomla.org/J4.x:Joomla_Core_APIs#Create_Article

avatar JulianR-HR
JulianR-HR - comment - 3 Feb 2022

Hi Quy,

no, I don't forgot the cadid

Please check the screenshot.

screen shot 2022-02-03 at 15 58 00


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36931.

avatar brianteeman
brianteeman - comment - 3 Feb 2022

@Quy the catid is there - thats literaly a copy/paste from the link you shared,

What I dont know is if the user has a category with an id of 64 and if not would the request fail because of that

avatar JulianR-HR
JulianR-HR - comment - 3 Feb 2022

Hi @brianteeman - I used another canid as you might see in the screenshot. canid 11 is valid on my page.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36931.

avatar Quy
Quy - comment - 4 Feb 2022

Please enclose the value with double quotes: "Titel"

avatar Quy Quy - change - 7 Feb 2022
Labels Added: Documentation Required
avatar Quy Quy - labeled - 7 Feb 2022
avatar Quy Quy - change - 7 Feb 2022
Labels Added: Information Required
Removed: Documentation Required
avatar Quy Quy - labeled - 7 Feb 2022
avatar Quy Quy - unlabeled - 7 Feb 2022
avatar Quy Quy - change - 8 Feb 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-02-08 18:51:59
Closed_By Quy
avatar Quy Quy - close - 8 Feb 2022
avatar Quy
Quy - comment - 8 Feb 2022

Closing as this is an entry error.

Add a Comment

Login with GitHub to post a comment