?
avatar brianteeman
brianteeman
27 Oct 2019

Using the json api I am able to successfully create articles and contacts - woohoo
I am also able to update basic fields in articles and contacts

The only thing that I have not been able to do (so far) is to change the value of the "state" field of an article
I can change the value of the "published" field in a contact

I am "guessing" that its com_workflow related??

avatar brianteeman brianteeman - open - 27 Oct 2019
avatar joomla-cms-bot joomla-cms-bot - change - 27 Oct 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Oct 2019
avatar wilsonge
wilsonge - comment - 27 Oct 2019

Yup definitely workflow related. I dunno how it's working in practice. But in theory state is a readonly field and you're going to modify the transition field in the API (which helpfully I'm not returning back because the com_content code massively predates that!)

avatar brianteeman
brianteeman - comment - 27 Oct 2019

OK thanks

Also regarding the list of fields that are returned in a get request. I see that the list is in the JsonapiView.php but how was the list chosen. Sometimes it is every field in the table eg banners and sometimes it is the absolute minimum eg contacts

avatar wilsonge
wilsonge - comment - 27 Oct 2019

In the first PR of com_content it was just the basic core fields. When we did the second round of components it was supposed to be expanded to cover everything largely useful. The aim of the core API is to expose everything practically useful. So if stuff's missing it should be added

avatar wilsonge
wilsonge - comment - 27 Oct 2019
avatar brianteeman
brianteeman - comment - 27 Oct 2019

The aim of the core API is to expose everything practically useful.

Hard to say what will be useful ;)

So if stuff's missing it should be added

I would suggest to add any field thats displayed in the UI

com_banners seems to be everything in the banners table
com_contact seems to be the absolute minimum

I am still learning this but we can talk on tuesday and work out a plan

avatar wilsonge
wilsonge - comment - 27 Oct 2019

Yup. I more mean for example in menus I don't want to show lft/rgt values - that kinda thing. anything in the UI basically should be and possibly even a few extra things too.

Can definitely talk tuesday

avatar brianteeman
brianteeman - comment - 27 Oct 2019

I will make a list of issues/questions

avatar alikon
alikon - comment - 28 Oct 2019

can i add 1 to your list ?
while testing a new webservices for actionlog i've noticed that the actioln log report need some care
Screenshot from 2019-10-28 20-18-57
when a webservice is invoked

avatar brianteeman
brianteeman - comment - 28 Oct 2019

@alikon thats a completely different issue - its the one that effects all the system plugins

avatar alikon
alikon - comment - 30 Oct 2019

i mean not the untranslated string, but that we are only logging the authentication and not an information on what webservice has been called

avatar brianteeman
brianteeman - comment - 30 Oct 2019

Sorry @wilsonge I thought I understood what you explained last night but I just dont get the state/workflow relationship

avatar wilsonge
wilsonge - comment - 31 Oct 2019

Imagine that state is a read only field. Update the transition field in the API to execute a transition using the transition id. That should have the effect of updating the state

avatar brianteeman
brianteeman - comment - 31 Oct 2019

so updating the transition will automagically update the state?

avatar wilsonge
wilsonge - comment - 31 Oct 2019

Yes - that's exactly how workflows work in the UI right now (for reference it triggers https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_content/Helper/ContentHelper.php#L84 this function)

avatar stefanoel
stefanoel - comment - 31 Oct 2019

The aim of the core API is to expose everything practically useful.

Hard to say what will be useful ;)

So if stuff's missing it should be added

I would suggest to add any field thats displayed in the UI

I noticed that every API expose a list of pagination links, like this:
{
"links": {
"self": "http:\/\/localhost\/api\/index.php\/v1\/config\/application",
"first": "http:\/\/localhost\/api\/index.php\/v1\/config\/application?page[offset]=0&page[limit]=20",
"next": "http:\/\/localhost\/api\/index.php\/v1\/config\/application?page[offset]=20&page[limit]=20",
"previous": "http:\/\/localhost\/api\/index.php\/v1\/config\/application?page[offset]=0&page[limit]=20",
"last": "http:\/\/localhost\/api\/index.php\/v1\/config\/application?page[offset]=80&page[limit]=20"
},

and all links are always available, even though they make no sense (i.e. First and Previous in the first page, Next and Last when the last page is reached). In the UI these buttons are disabled:
Plugins - Administration
I suppose unnecessary links could be avoided...

avatar wilsonge
wilsonge - comment - 31 Oct 2019

https://jsonapi.org/format/#fetching-pagination
Keys MUST either be omitted or have a null value to indicate that a particular link is unavailable.

We can probably make some of these links null to reflect that. All that code lives here https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/View/JsonApiView.php#L138-L176 so feel free to tweak it!

avatar wilsonge wilsonge - change - 19 Dec 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-12-19 03:14:58
Closed_By wilsonge
avatar wilsonge wilsonge - close - 19 Dec 2020
avatar wilsonge
wilsonge - comment - 19 Dec 2020

Im going to close this as I think the original issue has been answered. Lots of the fields have since been standardised and we can open specific issues for anything that hasn’t been addressed

Add a Comment

Login with GitHub to post a comment