Jump to: navigation, search

Difference between revisions of "Horizon/RESTAPI"

Line 1: Line 1:
  
== Heading text ==
+
== Horizon REST API ==
Horizon has a REST API that allows client side code to make API calls directly without DJANGO server side rendering. This is to support the angular work.  
+
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.
  
 
'''THE API ARE FOR THE EXCLUSIVE USE OF HORIZON DEVELOPMENT AND ARE NOT SUPPORTED FOR EXTERNAL USE AT THIS TIME'''
 
'''THE API ARE FOR THE EXCLUSIVE USE OF HORIZON DEVELOPMENT AND ARE NOT SUPPORTED FOR EXTERNAL USE AT THIS TIME'''
 +
 +
=== Testing ===
  
 
To Test the Horizon REST APIs using POSTMAN (Chrome Plugin)ː
 
To Test the Horizon REST APIs using POSTMAN (Chrome Plugin)ː
Line 9: Line 11:
 
# Login normally going to the exact API address (or localhost) that you'll use from POSTMAN
 
# Login normally going to the exact API address (or localhost) that you'll use from POSTMAN
  
=== GET requests ===
+
==== GET requests =====
 
Input the URL.  For exampleː http://127.0.0.1:8005/api/glance/images
 
Input the URL.  For exampleː http://127.0.0.1:8005/api/glance/images
 
Set the following headers
 
Set the following headers
Line 19: Line 21:
 
|}
 
|}
  
=== POST requests ===
+
==== POST requests ====
 
Input the URL.  For exampleː http://127.0.0.1:8005/api/nova/keypairs/
 
Input the URL.  For exampleː http://127.0.0.1:8005/api/nova/keypairs/
  

Revision as of 00:42, 19 February 2015

Horizon REST API

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.

THE API ARE FOR THE EXCLUSIVE USE OF HORIZON DEVELOPMENT AND ARE NOT SUPPORTED FOR EXTERNAL USE AT THIS TIME

Testing

To Test the Horizon REST APIs using POSTMAN (Chrome Plugin)ː

  1. Login normally going to the exact API address (or localhost) that you'll use from POSTMAN

GET requests =

Input the URL. For exampleː http://127.0.0.1:8005/api/glance/images Set the following headers

Header Value
X-Requested-With XMLHttpRequest

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 a current token

Set the raw content as JSON formatted.

Exampleː

{
 "name":"foo" 
}