2

Simply put when using the API to update a custom field of an article, the new information is not successfully passed through. Furthermore, the original contents are deleted from the field.

The deletion of the original field contents does tell me that the field can be affected. It would be problematic if custom fields can not be updated via the API. So I am also curious if custom fields have something more that needs to be appended to the name in order for it to work. Such as what is needed for the article text field to be updated via API, since that uses fulltext and introtext instead of text and articletext.

Video example

1

Actually it works. This can be done by issuing a PATCH request to the content/articles/{{article_id}} endpoint

{{base_url}}/{{base_path}}/content/articles/{{article_id}}

Replace {{base_url}} with your actual base_url ex:

https://example.org

Replace {{base_path}} with your actual base_path. Usually it is:

api/index.php/v1

Replace {{article_id}} with the actual article id for which you want to update the custom field value ex: 1

So for example using curl you can do something like

curl -X PATCH --url 'http://example.org/api/index.php/v1/content/articles/1' -H 'X-Joomla-Token: your_joomla_api_token' -H 'Content-Type: application/json' -d '{"buy-now":"https://www.joomla.org"}'

Assuming that the custom field is of type url and it's called buy-now (the name of the custom field in the admin of Joomla! 4.x)

Of course change your token with the one from your website.

If you want a more comprehensive list of possibilities of Joomla! 4 Web Services you can find out more Unofficial Joomla! 4.x Postman Colllection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.