Hey Phillip, Checkout sign_request method here: https://github.com/apache/cloudstack-cloudmonkey/blob/master/cloudmonkey/requester.py#L192
If you read this code, you’ll understand how to sign API requests and make calls. I have n’t read the docs, but if you want to contribute please send a pull request on: https://github.com/apache/cloudstack-docs/blob/master/rtd/source/dev.rst Thanks. > On 12-Nov-2014, at 9:46 pm, Phillip Kent <[email protected]> wrote: > > Dear all, > > I was looking at handling of case in API calls and I believe the docs > page has a slight mistake in the code example: > > http://docs.cloudstack.apache.org/en/latest/dev.html#the-cloudstack-api > > The signature generation instructions say: > "Lower case the entire Command String and sort it alphabetically" > > however the sample code does this: > > sig_str='&'.join(['='.join([k.lower(),urllib.quote_plus(request[k].lower().replace('+','%20'))])for > k in sorted(request.iterkeys())]) > > which I think is the other way around (sort then lowercase). > > This will cause a problem if I send an API request of the form: > apiKey=........&Command=listZones&..... > > Putting the capital C on Command is an odd thing to do but it should > be allowed because the parameter 'field' is not case sensitive, > according to the docs page. > > Now because the 'sort first' will put 'Command=...' before > 'apiKey=...' this will give a different signature, compared with > 'lowercase first'. > > So then I started to run some tests against my CloudStack API server > and actually I am finding that API calls *do* fail if I change the > case of the parameter fields. For example, if I do > > cOMMAND=listZones > > This does not change parameter order or the signature value, but the > API call fails with error 401 "unable to verify user credentials > and/or request signature". > > Has anyone else seen this kind of behaviour? > > Thx Phillip Regards, Rohit Yadav Software Architect, ShapeBlue M. +91 88 262 30892 | [email protected] Blog: bhaisaab.org | Twitter: @_bhaisaab Find out more about ShapeBlue and our range of CloudStack related services IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//> CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/> CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/> CloudStack Software Engineering<http://shapeblue.com/cloudstack-software-engineering/> CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/> CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/> This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.
