No Code Attached Yet bug ?
avatar MayaSima
MayaSima
31 Jul 2022

Steps to reproduce the issue

Create an article via a POST call to Joomla API and send an array of tag_ids

Expected result

"tags": {
"27": "Politics",
"673": "Spencer Lindquist",
"674": "Social Justice",
"675": "Critical Race Theory",
"676": "Dei",
"677": "Drug Overdose",
"678": "Woke",
"679": "Crt"
},

Actual result

"tags": {
"27": "Critical Race Theory",
"673": "Crt",
"674": "Dei",
"675": "Drug Overdose",
"676": "Politics",
"677": "Social Justice",
"678": "Spencer Lindquist",
"679": "Woke"
},

System information (as much as possible)

Joomla! 4.1.5 Stable [ Kuamini ] 21-June-2022 14:00 GMT
PHP 8.0.21
MySQL 8.0.29

Additional comments

Summary
When creating an article via a POST call to Joomla API and sending an array of tag_ids, Joomla API returns a response with tags object being populated:
Sent:
"tags": [
"675",
"674",
"676",
"677",
"678",
"679",
"27",
"673"
],
Received:
"tags": {
"27": "Critical Race Theory",
"673": "Crt",
"674": "Dei",
"675": "Drug Overdose",
"676": "Politics",
"677": "Social Justice",
"678": "Spencer Lindquist",
"679": "Woke"
},

However, the mappings between ids and tag names are wrong. See the correct ids for each tag as configured in Joomla on this screenshot:
Tags Screenshot

A subsequent GET call to the same article, which has just been created, results in a response with tag array being empty:
"tags": []

Running PATCH request for the same article with the same list of tag_ids yields the exact same behavior, but the tags do not get wiped anymore.
Subsequent GET calls continue return result with the correct set of tags, but wrong mappings between ids and names.

Making GET request to tags endpoint ({{base_path}}/api/index.php/v1/tags) returns correct mapping for all tags, so the issue is only on the article level.

Temporary Workaround
To work around this problem, I have to make a PATCH request with the same payload right after making a POST request for every new article.

avatar MayaSima MayaSima - open - 31 Jul 2022
avatar joomla-cms-bot joomla-cms-bot - change - 31 Jul 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 31 Jul 2022
avatar richard67 richard67 - change - 31 Jul 2022
Labels Added: ?
avatar richard67 richard67 - labeled - 31 Jul 2022
avatar alikon
alikon - comment - 3 Aug 2022

you need to pass the tag id's and not the tag's title

image

avatar MayaSima
MayaSima - comment - 16 Aug 2022

I am passing the tag id's.

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar alikon alikon - change - 20 Aug 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-08-20 07:23:26
Closed_By alikon
avatar alikon alikon - close - 20 Aug 2023
avatar alikon
alikon - comment - 20 Aug 2023

please test #41397

Add a Comment

Login with GitHub to post a comment