|
|
@@ -1,36 +1,51 @@
|
|
|
+# WP API Developer Console
|
|
|
|
|
|
-WordPress.com REST API Developer Console
|
|
|
-================
|
|
|
+An open source version of https://developer.wordpress.com/docs/api/console/ that
|
|
|
+works with WP API.
|
|
|
|
|
|
-An open source version of https://developer.wordpress.com/docs/api/console/ that you can run yourself. Uses implicit OAuth for authentication.
|
|
|
-The console requires a WordPress.com application to be created.
|
|
|
+## Setting Up
|
|
|
|
|
|
-## Configuring the console
|
|
|
+### Step 1: Creating a Consumer
|
|
|
+Once you have WP API and the OAuth server plugins activated on your server,
|
|
|
+you'll need to create a "consumer". This is an identifier for the application,
|
|
|
+and includes a "key" and "secret", both needed to link to your site.
|
|
|
|
|
|
-### Create an Application
|
|
|
+To create the consumer, run the following **on your server**:
|
|
|
+```bash
|
|
|
+$ wp oauth1 add
|
|
|
|
|
|
-1. Login to WordPress.com
|
|
|
-2. Visit https://developer.wordpress.com/apps/
|
|
|
-3. Click "Create New Application"
|
|
|
-4. Full in your applications name and description
|
|
|
-5. Enter a redirect URI for your application. See http://developer.wordpress.com/docs/oauth2/ for more information
|
|
|
-6. Enter any domains you plan on accessing the console from in the "Javascript Origins" box
|
|
|
-7. Click 'Create'
|
|
|
-8. Note the "Client ID" and "Redirect URL" fields
|
|
|
+ID: 4
|
|
|
+Key: sDc51JgH2mFu
|
|
|
+Secret: LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW
|
|
|
+```
|
|
|
|
|
|
-### Provide the console your application setting
|
|
|
+Note the key and secret returned here. You'll need those in a moment.
|
|
|
|
|
|
-Once you have your application credentials you need to create a configuration file for your application.
|
|
|
+### Step 2: Save your configuration
|
|
|
+Time to link the console to your site. Copy `config.sample.json` to
|
|
|
+`config.json` and begin editing. You'll need to set all options in there, and
|
|
|
+your `api_url` setting should point to your API install without the
|
|
|
+trailing slash:
|
|
|
|
|
|
-Wherever you have placed the console (the index.html, js, and css folders) create a "config.json" file with the following contents:
|
|
|
+```json
|
|
|
+{
|
|
|
+ "api_url": "http://example.com/wp-json",
|
|
|
+ "client_key": "sDc51JgH2mFu",
|
|
|
+ "client_secret": "LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW"
|
|
|
+}
|
|
|
+```
|
|
|
|
|
|
- {
|
|
|
- "client_id": _CLIENT_ID_,
|
|
|
- "redirect_uri": "_REDIRECT_URI_"
|
|
|
- }
|
|
|
-
|
|
|
-You can use the config.sample.json as a base.
|
|
|
+Replace `http://example.com/` with the site you're running WP API on.
|
|
|
|
|
|
-Replace _CLIENT_ID with the ID from above and _REDIRECT_URI_ with the URI from above.
|
|
|
+### Step 3: Run it!
|
|
|
+Open the console in your browser. You should see routes appear in the top left
|
|
|
+of your screen. (If these are missing, your `api_url` is set incorrectly.)
|
|
|
|
|
|
-You should now be able to load the console and authenticate using the box in the lower right hand corner.
|
|
|
+To make authenticated requests, simply hit the **Auth** button and follow the
|
|
|
+steps on-screen!
|
|
|
+
|
|
|
+## Credits
|
|
|
+* Uses code based on OpenStreetMap's [osm-auth][]. Licensed under the public
|
|
|
+ domain.
|
|
|
+
|
|
|
+[osm-auth]: https://github.com/osmlab/osm-auth
|