Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Andy_D created an issue. See original summary.

Andy_D’s picture

Issue summary: View changes
Andy_D’s picture

Issue summary: View changes
Wim Leers’s picture

Priority: Normal » Major

Major at least I think.

clemens.tolboom’s picture

Priority: Major » Normal

According to https://www.drupal.org/docs/8/core/modules/rest/3-post-for-creating-cont... aka https://www.drupal.org/node/2098511

In all examples below, we POST to the URL /entity/node. Since Drupal 8.2.0, you are able to POST to /node instead, but /entity/node will continue to work until Drupal 9. [Note: This didn't work with trunk as of 2016/10/15, but the path /entity/node did work. ]

The issue is #2293697: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available

@Andy_D can you confirm this POST @ /node works on Drupal 8.2.0 then please close the issue as Works as designed.

Wim Leers’s picture

Well, that was tantalizingly close to being committed, but then eventually didn't make it into Drupal 8.3.

Fixed the docs: https://www.drupal.org/node/2098511/revisions/view/10162711/10216654 (sadly that diff is completely wrong because of the docs migration — the right change is in there, but lots of irrelevant changes are attributed to this new revision too…)

IMO this cannot be closed as working as designed. For the entire Drupal 8.2 cycle, this will continue to confuse end users. It should be fixed.

gvso’s picture

Now that we have 1.13 version which works for Drupal >=8.2, could this change be done in versions <= 1.12?

Wim Leers’s picture

Title: Confusing interface » [PP-1] Confusing interface
Category: Feature request » Task
Status: Active » Postponed
Issue tags: +Usability

#7: you need to update from Drupal <8.2 to 8.2 anyway: 8.0 and 8.1 are no longer supported. So that doesn't make sense.

Let's just mark this blocked on #2293697: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available, then this problem will disappear automatically.

clemens.tolboom’s picture

Issue summary: View changes
Wim Leers’s picture

Title: [PP-1] Confusing interface » Confusing UI: POST URL differs from GET/PATCH/DELETE URL, but UI doesn't indicate this!
Version: 8.x-1.11 » 8.x-1.x-dev
Assigned: Unassigned » Wim Leers
Status: Postponed » Active
Wim Leers’s picture

Sorry, lost track of this. Will finish it today.

Wim Leers’s picture

Done.

Changes:

  1. Now shows the POST path (i.e. the create link relation type URI path).
  2. But not if it's a config entity, because config entities remain read-only until #2300677: JSON:API POST/PATCH support for fully validatable config entities is fixed. Related: #2869724: Convert module to use short array syntax (new coding standard)..
  3. If a REST resource plugin supports only canonical (GET/PATCH/DELETE) or only create (POST), it's shown on a single line. Otherwise, we use a <dl> to make it visually clear.
  4. If this REST resource plugin is configured (and either enabled or disabled), it shows the methods that are configured to be disabled as struck through.
  5. Supports both 8.3.x and 8.4.x.
8.3.x
8.4.x
Notes
These are both the exact same configuration (exact same site).
Note that the DELETE method is disabled for Comment.
Note that all methods except POST are disabled for Contact message.
Note that all config entities have that same simplified single-line representation. As does the User registration resource. So this also fixes #2877569: Path /user/register is not presented in the UI:

clemens.tolboom’s picture

  • Wim Leers authored f960ed1 on 8.x-1.x
    Issue #2800097 by Wim Leers, clemens.tolboom, Andy_D: Confusing UI: POST...

Status: Needs review » Needs work

The last submitted patch, 14: confusing_ui_post_url-2800097-14.patch, failed testing. View results

clemens.tolboom’s picture

Status: Needs work » Fixed

I was quicker with commit then testbot

Wim Leers’s picture

+++ b/src/Controller/RestUIController.php
@@ -188,14 +188,8 @@ class RestUIController implements ContainerInjectionInterface {
-          $uri_paths = <<<HTML
-<dl>
-  <dt><code>$canonical_uri_path

-

$canonical_methods

-

$create_uri_path

-

POST

-

-HTML;
+ $uri_paths = "$canonical_uri_path: $canonical_methods";
+ $uri_paths.= "$create_uri_path: POST";

This negatively impacted legibility IMHO. OTOH, it does make for higher information density. See screenshot:

Compare this to the screenshots in #12.

You're the maintainer, your call :)

Thanks for getting this committed and tagging a release: https://www.drupal.org/project/restui/releases/8.x-1.15 :)

clemens.tolboom’s picture

Thanks for your work!!

Wim Leers’s picture

Issue tags: +API-First Initiative

:)

Thank Acquia for sponsoring my time on the API-first Initiative! That's why I'm able to work on these issues :)

clemens.tolboom’s picture

I'm currently projectless so can spend time on my d.o projects finally

Wim Leers’s picture

Cool :) (Well, not cool if it lasts too long of course!)

P.S.: I wouldn't mind to see Acquia being added to the list of supporting organizations on the project page. I think that's fair? (Acquia didn't ask me to ask this, you just made me think of that!)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Andy_D’s picture

Thanks to everyone for their work on this issue!

Wim Leers’s picture

You're welcome :)