Can we extend Drush to do real page request, even subpage request, REST calls which calls like

drush @drupal.d8 get admin/modules
drush @drupal.d8 --user=that-user get user
drush @drupal.d8 --rest get entity/node/2

mimicking command-lines like

wget http://drupal.d8/admin
curl -H "Accept: application/hal+json" --include --request GET --cookie SESS0xx=7VWxx http://drupal.d8/entity/node/2

Context

In trying to support the the twig team to do some html diffing I started with Drush DOM Tree using file_get_contents trying to grab some Drupal 8 pages, switch branch, grab the same pages again next diff the result. I somehow failed with session handling and tree parsing mostly. I needed to0 many plumbing doing (logout user/login user/grab page) so guess I missed some skills.

Comments

greg.1.anderson’s picture

I'm not sure if logging in to Drupal and fetching pages should be standard Drush behavior; however, if you'd like some code that will log in and manage a session, take a look at the drush iq-submit command in the drush_iq extension.

moshe weitzman’s picture

Status: Active » Closed (duplicate)