Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ldayan/de052c236d2c548b8dbe to your computer and use it in GitHub Desktop.

Select an option

Save ldayan/de052c236d2c548b8dbe to your computer and use it in GitHub Desktop.
curl -sS https://getcomposer.org/installer | php
composer global require drush/drush:dev-master
drush qd --core=drupal-8.0.x
# Note the password created for admin will be different from the examples. Either change example or in your Drupal install.
cd quick-drupal
drush en rest hal basic_auth -y
# Create a new page node
curl --include \
--request POST \
--user admin:password \
--header 'Content-type: application/hal+json' \
http://local.drupal8.org/entity/node \
--data-binary '{"_links":{"type":{"href":"http://local.drupal8.org/rest/type/node/page"}}, "title":[{"value":"test title"}]}'
# Get a new page node
curl -H "Accept: application/hal+json" --user admin:password -XGET http://local.drupal8.org/node/1
# Update that node
curl --include \
--request PATCH \
--user admin:password \
--header 'Content-type: application/hal+json' \
http://local.drupal8.org/node/1 \
--data-binary '{"_links":{"type":{"href":"http://local.drupal8.org/rest/type/node/page"}}, "title":[{"value":"test title 2"}]}'
# Delete that node
curl -H "Accept: application/hal+json" --user admin:password -XDELETE http://local.drupal8.org/node/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment