Calling Cloud Stack With Parameters

后端 未结 1 1725
暗喜
暗喜 2021-01-25 23:11

i am trying to make an api call using the below code and it works fine

import urllib2
import urllib
import hashlib
import hmac
import base64


baseurl=\'http://         


        
相关标签:
1条回答
  • 2021-01-25 23:32

    Add additional parameters to the the request dictionary.

    E.g. listUsers allows details of a specific username to be listed (listUsers API Reference). To do so, you'd update request creation as follows:

    request={}
    request['command']='listUsers'
    request['username']='admin'
    request['response']='xml'
    request['apikey']='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    

    Also the Rules for Signing say to "Lower case the entire Command String and sort it alphabetically via the field for each field-value pair" This section of the docs also covers adding an expiry to the URL.

    Finally, you need to ensure the HTTP GET is not cached by network infrastructure by making each HTTP GET unique. The CloudStack API uses a cache buster. Alternatively, you can add an expiry to each query, or use an HTTP POST.

    0 讨论(0)
提交回复
热议问题