Error creating new API through Dashboard REST API

Sometimes copying and pasting the commands causes the JSON object to become invalid, there’s a nicer form you can use:

1. Create a file called my-api.json

2. Add the API object to it (remove the back slashes):

{
	"api_definition": {
		"name": "My API Test",
		"slug": "myapi-test-api",
		"auth": {
			"auth_header_name": "Authorization"
		},
		"definition": {
			"location": "header",
			"key": "x-api-version"
		},
		"version_data": {
			"not_versioned": true,
			"versions": {
				"Default": {
					"name": "Default",
					"use_extended_paths": true
				}
			}
		},
		"proxy": {
			"listen_path": "/myapi_test/",
			"target_url": "http://httpbin.org/",
			"strip_listen_path": true
		},
		"active": true
	}
}

(I tend to run the JSON through something like JSONlint.org to make sure it’s ok)

3. Then use the curl file form:

curl -H "Authorization: a768f533927f41c065c9db703cc88070" -s -H "Content-Type: application/json" -X POST -d @my-api.json http://localhost:3000/api/apis/ | python -mjson.tool

That should remove validation issues and make it easier to edit/test/repeat.