Horizon/RESTAPI
Contents
Horizon REST API
Starting in Kilo, Horizon has a REST API that allows client side code to make API through the Horizon server without DJANGO server side rendering. This is to support the angular work being done in Horizon. It takes care of issues like cross origin resource scripting as well as leveraging authentication and authorization libraries already in existence.
THESE APIs ARE FOR THE EXCLUSIVE USE OF HORIZON DEVELOPMENT AND ARE NOT INTENDED FOR EXTERNAL USE AT THIS TIME
They are very early in development and intended to support in tree development. Until further notice, there will be no deprecation period if they need to change.
Status
Liberty
Server sideː [1] Client sideː [2]
Kilo
Summit Talkː [3] Server sideː [4] Client sideː [5]
Testing
To Test the Horizon REST APIs using POSTMAN (Chrome Plugin), login normally going to the exact API address (or localhost) that you'll use from POSTMAN. Once you've logged in your browser will have an access cookie that it'll pass on with all its requests.
GET requests
Input the URL.
For exampleː http://127.0.0.1:8005/api/glance/images
Set the following header:
Header | Value |
---|---|
X-Requested-With | XMLHttpRequest |
The GET requests should include a csrftoken cookie (eg. csrftoken=onXnBfMqIxuFGr437P91Uuxdl09t2ykQ). You should copy this off if you need to perform any POST requests.
POST requests
Input the URL.
For exampleː http://127.0.0.1:8005/api/nova/keypairs/
Set the following headers
Header | Value |
---|---|
X-Requested-With | XMLHttpRequest |
Content-Type | application/json |
X-CSRFToken | the value of the csrftoken cookie you've seen in any GET request to the same address. You can obtain the token from the cookie sent via your REQUEST headers of the above GET call. |
Set the raw content as JSON formatted.
Exampleː
{ "name":"foo" }
Postman Collections
Some POSTMAN Collections to help with testing can be found below. The date that they worked is listed and collection follows.
2015-04-06
Keystone: https://www.getpostman.com/collections/311080eb87c7bca1b7b1 Neutron: https://www.getpostman.com/collections/401a40ae526887e378ef Network: https://www.getpostman.com/collections/be29e7af5243d09d8b99 Nova Direct: https://www.getpostman.com/collections/0b6e8b0eb23687bfeec0 Nova Horizon: https://www.getpostman.com/collections/1c24ae62ea46c8a56791 Policy: https://www.getpostman.com/collections/acf134dde5c77ad81a1b Cinder: https://www.getpostman.com/collections/6c7391cd25603c2218fe Config: https://www.getpostman.com/collections/b64d279e663de38897c8 Glance: https://www.getpostman.com/collections/2dd5e5e2e849bf3880fc