? ?
avatar pjdevries
pjdevries
29 May 2021

Steps to reproduce the issue

Access a PATCH or DELETE endpoint.

Expected result

A valid JSON:API document response.

Actual result

PATCH: []
DELETE: 1

avatar pjdevries pjdevries - open - 29 May 2021
avatar joomla-cms-bot joomla-cms-bot - change - 29 May 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 May 2021
avatar alikon alikon - change - 29 May 2021
Labels Added: ?
avatar alikon alikon - labeled - 29 May 2021
avatar wilsonge
wilsonge - comment - 30 May 2021

Agree patch needs fixing.

To me delete should be returning the empty response as https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/Controller/ApiController.php#L322 doesn’t output anything. Should be an easy fix somewhere

avatar wilsonge
wilsonge - comment - 30 May 2021

OK just tested this - for me I'm not getting any response back from delete (as expected).

Obviously as you say patch is incorrect

avatar alikon
alikon - comment - 31 May 2021

so for the PATCH
this will be enough in your opinion ? @wilsonge @pjdevries
after this line

adding $this->displayItem($recordId);

avatar pjdevries
pjdevries - comment - 31 May 2021

@alikon Makes sense, since POST is handled in a similar fashion. But I'm not the expert, so I leave it up to @wilsonge.

avatar alikon
alikon - comment - 31 May 2021

better discuss with code ?
see #34313

avatar alikon alikon - close - 31 May 2021
avatar alikon alikon - change - 31 May 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-05-31 17:12:11
Closed_By alikon
Labels Added: ?
Removed: ?
avatar pjdevries
pjdevries - comment - 2 Jun 2021

OK just tested this - for me I'm not getting any response back from delete (as expected).

Don't want to nit pick, bu no response is not entirely as expected. That is to say, if we want to comply with the JSON:API completely. Take a look at JSON:API says about DELETE responses. A 200 response should return 'only top-level meta data'.

avatar wilsonge
wilsonge - comment - 2 Jun 2021

Don't want to nit pick, bu no response is not entirely as expected. That is to say, if we want to comply with the JSON:API completely. Take a look at JSON:API says about DELETE responses. A 200 response should return 'only top-level meta data'.

I agree but I'm getting back a 204 not a 200 (which is expected as we're setting that here https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/Controller/ApiController.php#L322) and that's totally allowed by JSON API in that section.

Would be useful to see what request you're getting a 200 from on a delete. Because I can't seem to reproduce that.

avatar pjdevries
pjdevries - comment - 2 Jun 2021

Would be useful to see what request you're getting a 200 from on a delete. Because I can't seem to reproduce that.

I'm getting a 200 from my recently added media web service :) Deleting an article gives me a 204 but also returns an unexpected literal 1 in the response.

avatar pjdevries
pjdevries - comment - 6 Jun 2021

@wilsonge The 200 response from my media web service was not correct, so I remedied that. It now returns a 204 but still also return a literal 1. Can't find where that happens though.

Add a Comment

Login with GitHub to post a comment