Get set up quickly
In this tutorial, we're going to be able to post content to a Drupal content type using the REST API. To do it, we're going to start from scratch with a fresh install and configure everything for the API so that you can see how to do it on your site.
- Check that you have PHP installed
- Create the database Drupal is going to use
- Install a fresh copy of Drupal 8 with drush
- Start up the webserver
- Install the site through browser
Do you have php installed? If not maybe this post isn't for you :)
% php -v
Let's make a database for our fresh Drupal 8 install. This assumes you have a .my.cnf file in your home directory so you don't have to put the password for root in.
% mysqladmin create drupalrestdemo
Install Drupal 8 from drush
One you do it this way, you'll never go back.
Make sure you have drush
% which drush
If that's blank
% brew install drush
Install Drupal from the command line
% drush dl drupal-8 --select
Let's use an oft overlooked feature of PHP - it comes with a webserver. Start it up so that we can use a browser to finish installing Drupal.
% cd [into the folder drush just created for Drupal] % php -S 127.0.0.1:9200
Leave this window open. You now have a webserver running on port 9200 for your Drupal site.
Open up a browser and go to http://127.0.0.1:9200 and go through the install steps for Drupal. Meet you back here in 2 minutes.