SlideShare a Scribd company logo
Introduction to the CloudStack
API
Sebastien Goasguen
@sebgoa
Outline
• Documentation
• Clients
• Exploration
• Integration port
• Signing requests
• REST or not REST
Documentation
http://cloudstack.apache.org/docs/api/apidocs-4.0.0/TOC_Root_Admin.html
http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.1-incubating/html/API_Developers_Guide/index.html
Clients
• 15 clients and
counting… on Github
• Java, Python, Perl,
Ruby, C#, php, Clojure
Exploration
• Use a debugger console
• E.g Firebug
• As you navigate the UI,
check the http calls that
are being made
• Identify the methods
• Identify the parameters
passed to each call
HTTP
based
• API calls made via HTTP(s)
• Pass name of the call as command
• Pass list of key/value pairs as arguments to
the call
• GET method
• Response can be XML or JSON
• Query API that is RESTlike
http://gehrcke.de/2009/06/aws-about-api/
Integration Port
• Unauthenticated call
– Dangerous
– Don’t open it all
– Certainly don’t open it to the public internet
• Set the port on the UI
Using the
integration port
http://localhost:8096/client/api?command=listUsers&response=json
curl 'http://localhost:8096/client/api?command=listUsers&response=json'
{ "listusersresponse" : { "count":3 ,"user" : [ {"id":"7ed6d5da-93b2-4545-a502-
23d20b48ef2a","username":"admin","firstname":"admin","lastname":"cloud","created":"2012-07-
05T12:18:27-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155-
4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-
kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg”…
http://localhost:8096/client/api?command=listUsers
curl http://localhost:8096/client/api?command=listUsers
<?xml version="1.0" encoding="ISO-8859-1"?><listusersresponse cloud-stack-version="3.0.3.2012-07-
04T06:31:57Z"><count>3</count><user><id>7ed6d5da-93b2-4545-a502-
23d20b48ef2a</id><username>admin</username><firstname>admin</firstname><lastname>cloud</lastname><
created>2012-07-05T12:18:27-
0700</created><state>enabled</state><account>admin</account><accounttype>1</accounttype><domainid>
8a111e58-e155-4482-93ce-
84efff3c7c77</domainid><domain>ROOT</domain><apikey>plgWJfZK4gyS3mOMTVmjUVg-X-
jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg…
http://www.shapeblue.com/2012/05/10/using-the-api-for-advanced-network-management/
Authenticated calls
• Using http(s)
• API endpoint for the cloud
– http://localhost:8080/client/api?
• Command key to pass the name of the call
• Key/value pairs for the arguments
• API key of the user making the call
• Signature for authorization
API Keys
• Generate API keys for the user that will access
the cloud
Creating the signature
• Form the request url: list of key=value
pairs joined by & and encoded for http
transport
• Compute the signature:
– lower case values, replace + with %20
– generate the hmac using sha1 hash function
– Base64 encode the digest
– Encode for http transport
• Form the entire request adding the signature:
&signature=
Example
>>> request
{'apikey': 'plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-
kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg', 'command': 'listUsers',
'response': 'json'}
>>>request_url="&".join(["=".join([r,urllib.quote_plus(request[r])
]) for r in request.keys()])
>>>sig_url="&".join(["=".join([r.lower(),urllib.quote_plus(request
[r]).lower()]) for r in sorted(request.iterkeys())])
>>>sig=urllib.quote_plus(base64.encodestring(hmac.new(secretkey,si
g_url,hashlib.sha1).digest()).strip())
>>> req=url+request_url+'&signature='+sig
>>> res=urllib2.urlopen(req)
>>> res.read()
REST
• REST stands for Representational State
Transfer
• Architectural style to design web services
introduced by Roy Fielding (former ASF chair)
• Premise:
– HTTP protocol is enough to create web services
and change the state of web resources
– HTTP methods can be used to change the state
– Eases web services design compared to SOAP
http://en.wikipedia.org/wiki/Roy_Fielding
http://en.wikipedia.org/wiki/Representational_State_Transfer
REST
• REST style web services couple be
implemented with other protocol than http
• But http provides all that is needed
http://en.wikipedia.org/wiki/Representational_State_Transfer
REST API
• The CloudStack API is a query API
• It is RESTlike but not RESTfull
• Example:
listUsers() a GET vs GET
updateUser() a GET vs PATCH
createUser() a GET vs POST
deleteUser() a GET vs DELETE
http://gehrcke.de/2009/06/aws-about-api/
http://publish.luisrei.com/articles/flaskrest.html
Exercise
• Build a REST interface to CloudStack
• Use Flask a Lightweight Python web
framework
http://flask.pocoo.org
http://publish.luisrei.com/articles/flaskrest.html
Exercise
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
Flask allows you to define web routes and
functions that get executed when these routes
are called.
Exercise
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
do_the_login()
else:
show_the_login_form()
curl -X DELETE
http://localhost:5000/user/b3b60a8dfdf6f-4ce6-a6f9-
6194907457a5
{ "deleteuserresponse" : { "success" : "true"} }
https://github.com/runseb/cloudstack-flask
http://buildacloud.org/blog/253-to-rest-or-not-to-rest.html
Info
• Apache Top Level Project (TLP)
• http://cloudstack.apache.org
• #cloudstack and #cloudstack-dev on irc.freenode.net
• @CloudStack on Twitter
• http://www.slideshare.net/cloudstack
• dev-subscribe@cloudstack.apache.org
• users-subscribe@cloudstack.apache.org
Welcoming contributions and feedback, Join the fun !

More Related Content

What's hot

[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
Ji-Woong Choi
 
[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개
[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개
[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개
OpenStack Korea Community
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90mins
Larry Cai
 
Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security Journey
Jerry Jalava
 
Kubernetes
KubernetesKubernetes
Kubernetes
erialc_w
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
NGINX, Inc.
 
Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18
Kangaroot
 
Introducing Vault
Introducing VaultIntroducing Vault
Introducing Vault
Ramit Surana
 
Istio a service mesh
Istio   a service meshIstio   a service mesh
Istio a service mesh
Chandresh Pancholi
 
NGINX: Basics and Best Practices EMEA
NGINX: Basics and Best Practices EMEANGINX: Basics and Best Practices EMEA
NGINX: Basics and Best Practices EMEA
NGINX, Inc.
 
NGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEA
NGINX, Inc.
 
Kubernetes PPT.pptx
Kubernetes PPT.pptxKubernetes PPT.pptx
Kubernetes PPT.pptx
ssuser0cc9131
 
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue
 
Introduction to OpenID Connect
Introduction to OpenID Connect Introduction to OpenID Connect
Introduction to OpenID Connect
Nat Sakimura
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
NHN FORWARD
 
Introduction to Apache Synapse
Introduction to Apache SynapseIntroduction to Apache Synapse
Introduction to Apache Synapse
Hiranya Jayathilaka
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best Practices
NGINX, Inc.
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
Thomas Fricke
 
K8s security best practices
K8s security best practicesK8s security best practices
K8s security best practices
Sharon Vendrov
 
CloudStack S3
CloudStack S3CloudStack S3
CloudStack S3
Sebastien Goasguen
 

What's hot (20)

[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
[오픈소스컨설팅]RHEL7/CentOS7 Pacemaker기반-HA시스템구성-v1.0
 
[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개
[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개
[OpenInfra Days Korea 2018] (Track 2) Neutron LBaaS 어디까지 왔니? - Octavia 소개
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90mins
 
Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security Journey
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
 
Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18
 
Introducing Vault
Introducing VaultIntroducing Vault
Introducing Vault
 
Istio a service mesh
Istio   a service meshIstio   a service mesh
Istio a service mesh
 
NGINX: Basics and Best Practices EMEA
NGINX: Basics and Best Practices EMEANGINX: Basics and Best Practices EMEA
NGINX: Basics and Best Practices EMEA
 
NGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEA
 
Kubernetes PPT.pptx
Kubernetes PPT.pptxKubernetes PPT.pptx
Kubernetes PPT.pptx
 
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
 
Introduction to OpenID Connect
Introduction to OpenID Connect Introduction to OpenID Connect
Introduction to OpenID Connect
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
Introduction to Apache Synapse
Introduction to Apache SynapseIntroduction to Apache Synapse
Introduction to Apache Synapse
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best Practices
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
 
K8s security best practices
K8s security best practicesK8s security best practices
K8s security best practices
 
CloudStack S3
CloudStack S3CloudStack S3
CloudStack S3
 

Viewers also liked

Git 101 for CloudStack
Git 101 for CloudStackGit 101 for CloudStack
Git 101 for CloudStack
Sebastien Goasguen
 
Apache CloudStack Google Summer of Code
Apache CloudStack Google Summer of CodeApache CloudStack Google Summer of Code
Apache CloudStack Google Summer of Code
Sebastien Goasguen
 
CloudStack and BigData
CloudStack and BigDataCloudStack and BigData
CloudStack and BigData
Sebastien Goasguen
 
DevCloud and CloudMonkey
DevCloud and CloudMonkeyDevCloud and CloudMonkey
DevCloud and CloudMonkey
Sebastien Goasguen
 
Cloud Automation with ProActive
Cloud Automation with ProActiveCloud Automation with ProActive
Cloud Automation with ProActiveBrian AMEDRO
 
BtrCloud CloudStack Plugin
BtrCloud CloudStack PluginBtrCloud CloudStack Plugin
BtrCloud CloudStack Pluginbuildacloud
 
UShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStackUShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStackbuildacloud
 
Build a Cloud Day Paris
Build a Cloud Day ParisBuild a Cloud Day Paris
Build a Cloud Day Paris
Sebastien Goasguen
 
Apalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and BillingApalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and Billing
buildacloud
 
Network Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient networkNetwork Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient network
Cloudflare
 
4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success
CloudCheckr
 
Vivienda romana
Vivienda romana Vivienda romana
Vivienda romana mfierro1
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
Sebastien Goasguen
 
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
철민 신
 
Sk planet 이야기
Sk planet 이야기Sk planet 이야기
Sk planet 이야기
종범 고
 
Collaboration for Dummies
Collaboration for DummiesCollaboration for Dummies
Collaboration for Dummies
Avaya Inc.
 
Analytics Roles: Part 1
Analytics Roles: Part 1 Analytics Roles: Part 1
Analytics Roles: Part 1
InterQuest Group
 
성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기
종범 고
 
Cloud stack for_beginners
Cloud stack for_beginnersCloud stack for_beginners
Cloud stack for_beginners
Radhika Puthiyetath
 

Viewers also liked (20)

Git 101 for CloudStack
Git 101 for CloudStackGit 101 for CloudStack
Git 101 for CloudStack
 
Apache CloudStack Google Summer of Code
Apache CloudStack Google Summer of CodeApache CloudStack Google Summer of Code
Apache CloudStack Google Summer of Code
 
CloudStack and BigData
CloudStack and BigDataCloudStack and BigData
CloudStack and BigData
 
DevCloud and CloudMonkey
DevCloud and CloudMonkeyDevCloud and CloudMonkey
DevCloud and CloudMonkey
 
Cloud Automation with ProActive
Cloud Automation with ProActiveCloud Automation with ProActive
Cloud Automation with ProActive
 
BtrCloud CloudStack Plugin
BtrCloud CloudStack PluginBtrCloud CloudStack Plugin
BtrCloud CloudStack Plugin
 
UShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStackUShareSoft Image Management for CloudStack
UShareSoft Image Management for CloudStack
 
Build a Cloud Day Paris
Build a Cloud Day ParisBuild a Cloud Day Paris
Build a Cloud Day Paris
 
Apalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and BillingApalia/Amysta Cloud Usage Metering and Billing
Apalia/Amysta Cloud Usage Metering and Billing
 
Network Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient networkNetwork Automation with Salt and NAPALM: a self-resilient network
Network Automation with Salt and NAPALM: a self-resilient network
 
4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success4 Prerequisites for DevOps Success
4 Prerequisites for DevOps Success
 
Vivienda romana
Vivienda romana Vivienda romana
Vivienda romana
 
Cloudstack UI Customization
Cloudstack UI CustomizationCloudstack UI Customization
Cloudstack UI Customization
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
 
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
[AUG] 칸반을 활용한 업무 프로세스 혁신 실천법
 
Sk planet 이야기
Sk planet 이야기Sk planet 이야기
Sk planet 이야기
 
Collaboration for Dummies
Collaboration for DummiesCollaboration for Dummies
Collaboration for Dummies
 
Analytics Roles: Part 1
Analytics Roles: Part 1 Analytics Roles: Part 1
Analytics Roles: Part 1
 
성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기성공하는 애자일을 위한 짧은 이야기
성공하는 애자일을 위한 짧은 이야기
 
Cloud stack for_beginners
Cloud stack for_beginnersCloud stack for_beginners
Cloud stack for_beginners
 

Similar to Intro to CloudStack API

Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - Basics
Sang-Min Park
 
Kubernetes API code-base tour
Kubernetes API code-base tourKubernetes API code-base tour
Kubernetes API code-base tour
Stefan Schimanski
 
Why should I care about REST?
Why should I care about REST?Why should I care about REST?
Why should I care about REST?
Miguel Sánchez Villafán
 
REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!
Stormpath
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKit
Joone Hur
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
reneechemel
 
REST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleREST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD Example
Backand Cohen
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
Soroush Dalili
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
Lorna Mitchell
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server
Masahiro Nagano
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
Philip Stehlik
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Innovecs
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
Oro Inc.
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
Web Services Testing
Web Services TestingWeb Services Testing
Web Services Testing
DataArt
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using Swagger
Salesforce Developers
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
Lorna Mitchell
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray test
kopiczko
 
Apache mod authまわりとか
Apache mod authまわりとかApache mod authまわりとか
Apache mod authまわりとか
Toshiyuki Terashita
 
Azure F#unctions
Azure F#unctionsAzure F#unctions
Azure F#unctions
☁️ Mikhail Shilkov
 

Similar to Intro to CloudStack API (20)

Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - Basics
 
Kubernetes API code-base tour
Kubernetes API code-base tourKubernetes API code-base tour
Kubernetes API code-base tour
 
Why should I care about REST?
Why should I care about REST?Why should I care about REST?
Why should I care about REST?
 
REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKit
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
 
REST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleREST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD Example
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
 
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Web Services Testing
Web Services TestingWeb Services Testing
Web Services Testing
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using Swagger
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray test
 
Apache mod authまわりとか
Apache mod authまわりとかApache mod authまわりとか
Apache mod authまわりとか
 
Azure F#unctions
Azure F#unctionsAzure F#unctions
Azure F#unctions
 

More from Sebastien Goasguen

Kubernetes Sealed secrets
Kubernetes Sealed secretsKubernetes Sealed secrets
Kubernetes Sealed secrets
Sebastien Goasguen
 
Kubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: KubelessKubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: Kubeless
Sebastien Goasguen
 
Serverless on Kubernetes
Serverless on KubernetesServerless on Kubernetes
Serverless on Kubernetes
Sebastien Goasguen
 
Kubernetes kubecon-roundup
Kubernetes kubecon-roundupKubernetes kubecon-roundup
Kubernetes kubecon-roundup
Sebastien Goasguen
 
On Docker and its use for LHC at CERN
On Docker and its use for LHC at CERNOn Docker and its use for LHC at CERN
On Docker and its use for LHC at CERN
Sebastien Goasguen
 
CloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use CasesCloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use Cases
Sebastien Goasguen
 
Kubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOSKubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOS
Sebastien Goasguen
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
Sebastien Goasguen
 
Moving from Publican to Read The Docs
Moving from Publican to Read The DocsMoving from Publican to Read The Docs
Moving from Publican to Read The DocsSebastien Goasguen
 
Cloud and Big Data trends
Cloud and Big Data trendsCloud and Big Data trends
Cloud and Big Data trends
Sebastien Goasguen
 
SDN: Network Agility in the Cloud
SDN: Network Agility in the CloudSDN: Network Agility in the Cloud
SDN: Network Agility in the Cloud
Sebastien Goasguen
 
CloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps AmsterdamCloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps Amsterdam
Sebastien Goasguen
 
CloudStack Clients and Tools
CloudStack Clients and ToolsCloudStack Clients and Tools
CloudStack Clients and Tools
Sebastien Goasguen
 
Intro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud DayIntro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud Day
Sebastien Goasguen
 
Apache CloudStack AlpesJUG
Apache CloudStack AlpesJUGApache CloudStack AlpesJUG
Apache CloudStack AlpesJUG
Sebastien Goasguen
 
CloudStack for Java User Group
CloudStack for Java User GroupCloudStack for Java User Group
CloudStack for Java User Group
Sebastien Goasguen
 
Cloud Standards and CloudStack
Cloud Standards and CloudStackCloud Standards and CloudStack
Cloud Standards and CloudStack
Sebastien Goasguen
 
MyCloud for $100k
MyCloud for $100kMyCloud for $100k
MyCloud for $100k
Sebastien Goasguen
 

More from Sebastien Goasguen (20)

Kubernetes Sealed secrets
Kubernetes Sealed secretsKubernetes Sealed secrets
Kubernetes Sealed secrets
 
Kubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: KubelessKubernetes Native Serverless solution: Kubeless
Kubernetes Native Serverless solution: Kubeless
 
Serverless on Kubernetes
Serverless on KubernetesServerless on Kubernetes
Serverless on Kubernetes
 
Kubernetes kubecon-roundup
Kubernetes kubecon-roundupKubernetes kubecon-roundup
Kubernetes kubecon-roundup
 
On Docker and its use for LHC at CERN
On Docker and its use for LHC at CERNOn Docker and its use for LHC at CERN
On Docker and its use for LHC at CERN
 
CloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use CasesCloudStack Conference Public Clouds Use Cases
CloudStack Conference Public Clouds Use Cases
 
Kubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOSKubernetes on CloudStack with coreOS
Kubernetes on CloudStack with coreOS
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
 
Moving from Publican to Read The Docs
Moving from Publican to Read The DocsMoving from Publican to Read The Docs
Moving from Publican to Read The Docs
 
Cloud and Big Data trends
Cloud and Big Data trendsCloud and Big Data trends
Cloud and Big Data trends
 
SDN: Network Agility in the Cloud
SDN: Network Agility in the CloudSDN: Network Agility in the Cloud
SDN: Network Agility in the Cloud
 
CloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps AmsterdamCloudStack / Saltstack lightning talk at DevOps Amsterdam
CloudStack / Saltstack lightning talk at DevOps Amsterdam
 
CloudStack Clients and Tools
CloudStack Clients and ToolsCloudStack Clients and Tools
CloudStack Clients and Tools
 
Intro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud DayIntro to CloudStack Build a Cloud Day
Intro to CloudStack Build a Cloud Day
 
Apache CloudStack AlpesJUG
Apache CloudStack AlpesJUGApache CloudStack AlpesJUG
Apache CloudStack AlpesJUG
 
Building FOSS clouds
Building FOSS cloudsBuilding FOSS clouds
Building FOSS clouds
 
CloudStack for Java User Group
CloudStack for Java User GroupCloudStack for Java User Group
CloudStack for Java User Group
 
Avoiding cloud lock-in
Avoiding cloud lock-inAvoiding cloud lock-in
Avoiding cloud lock-in
 
Cloud Standards and CloudStack
Cloud Standards and CloudStackCloud Standards and CloudStack
Cloud Standards and CloudStack
 
MyCloud for $100k
MyCloud for $100kMyCloud for $100k
MyCloud for $100k
 

Recently uploaded

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 

Intro to CloudStack API

  • 1. Introduction to the CloudStack API Sebastien Goasguen @sebgoa
  • 2. Outline • Documentation • Clients • Exploration • Integration port • Signing requests • REST or not REST
  • 4. Clients • 15 clients and counting… on Github • Java, Python, Perl, Ruby, C#, php, Clojure
  • 5. Exploration • Use a debugger console • E.g Firebug • As you navigate the UI, check the http calls that are being made • Identify the methods • Identify the parameters passed to each call
  • 6. HTTP based • API calls made via HTTP(s) • Pass name of the call as command • Pass list of key/value pairs as arguments to the call • GET method • Response can be XML or JSON • Query API that is RESTlike http://gehrcke.de/2009/06/aws-about-api/
  • 7. Integration Port • Unauthenticated call – Dangerous – Don’t open it all – Certainly don’t open it to the public internet • Set the port on the UI
  • 8. Using the integration port http://localhost:8096/client/api?command=listUsers&response=json curl 'http://localhost:8096/client/api?command=listUsers&response=json' { "listusersresponse" : { "count":3 ,"user" : [ {"id":"7ed6d5da-93b2-4545-a502- 23d20b48ef2a","username":"admin","firstname":"admin","lastname":"cloud","created":"2012-07- 05T12:18:27-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155- 4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM- kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg”… http://localhost:8096/client/api?command=listUsers curl http://localhost:8096/client/api?command=listUsers <?xml version="1.0" encoding="ISO-8859-1"?><listusersresponse cloud-stack-version="3.0.3.2012-07- 04T06:31:57Z"><count>3</count><user><id>7ed6d5da-93b2-4545-a502- 23d20b48ef2a</id><username>admin</username><firstname>admin</firstname><lastname>cloud</lastname>< created>2012-07-05T12:18:27- 0700</created><state>enabled</state><account>admin</account><accounttype>1</accounttype><domainid> 8a111e58-e155-4482-93ce- 84efff3c7c77</domainid><domain>ROOT</domain><apikey>plgWJfZK4gyS3mOMTVmjUVg-X- jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg… http://www.shapeblue.com/2012/05/10/using-the-api-for-advanced-network-management/
  • 9. Authenticated calls • Using http(s) • API endpoint for the cloud – http://localhost:8080/client/api? • Command key to pass the name of the call • Key/value pairs for the arguments • API key of the user making the call • Signature for authorization
  • 10. API Keys • Generate API keys for the user that will access the cloud
  • 11. Creating the signature • Form the request url: list of key=value pairs joined by & and encoded for http transport • Compute the signature: – lower case values, replace + with %20 – generate the hmac using sha1 hash function – Base64 encode the digest – Encode for http transport • Form the entire request adding the signature: &signature=
  • 12. Example >>> request {'apikey': 'plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM- kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg', 'command': 'listUsers', 'response': 'json'} >>>request_url="&".join(["=".join([r,urllib.quote_plus(request[r]) ]) for r in request.keys()]) >>>sig_url="&".join(["=".join([r.lower(),urllib.quote_plus(request [r]).lower()]) for r in sorted(request.iterkeys())]) >>>sig=urllib.quote_plus(base64.encodestring(hmac.new(secretkey,si g_url,hashlib.sha1).digest()).strip()) >>> req=url+request_url+'&signature='+sig >>> res=urllib2.urlopen(req) >>> res.read()
  • 13. REST • REST stands for Representational State Transfer • Architectural style to design web services introduced by Roy Fielding (former ASF chair) • Premise: – HTTP protocol is enough to create web services and change the state of web resources – HTTP methods can be used to change the state – Eases web services design compared to SOAP http://en.wikipedia.org/wiki/Roy_Fielding http://en.wikipedia.org/wiki/Representational_State_Transfer
  • 14. REST • REST style web services couple be implemented with other protocol than http • But http provides all that is needed http://en.wikipedia.org/wiki/Representational_State_Transfer
  • 15. REST API • The CloudStack API is a query API • It is RESTlike but not RESTfull • Example: listUsers() a GET vs GET updateUser() a GET vs PATCH createUser() a GET vs POST deleteUser() a GET vs DELETE http://gehrcke.de/2009/06/aws-about-api/ http://publish.luisrei.com/articles/flaskrest.html
  • 16. Exercise • Build a REST interface to CloudStack • Use Flask a Lightweight Python web framework http://flask.pocoo.org http://publish.luisrei.com/articles/flaskrest.html
  • 17. Exercise from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run(debug=True) Flask allows you to define web routes and functions that get executed when these routes are called.
  • 18. Exercise @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': do_the_login() else: show_the_login_form() curl -X DELETE http://localhost:5000/user/b3b60a8dfdf6f-4ce6-a6f9- 6194907457a5 { "deleteuserresponse" : { "success" : "true"} } https://github.com/runseb/cloudstack-flask http://buildacloud.org/blog/253-to-rest-or-not-to-rest.html
  • 19. Info • Apache Top Level Project (TLP) • http://cloudstack.apache.org • #cloudstack and #cloudstack-dev on irc.freenode.net • @CloudStack on Twitter • http://www.slideshare.net/cloudstack • dev-subscribe@cloudstack.apache.org • users-subscribe@cloudstack.apache.org Welcoming contributions and feedback, Join the fun !