Last active
August 29, 2015 14:21
-
-
Save rjcorwin/9ade7759cf1535ec7467 to your computer and use it in GitHub Desktop.
Set up environment and do a round of CRUD on the page content type.
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