Forked from rjcorwin/setup-drupal8-rest-server-and-test-it.sh
Last active
August 29, 2015 14:22
-
-
Save ldayan/de052c236d2c548b8dbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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