I am using OpenStack's REST API for programmatic implementation of start or stop server.
The link for API reference is http://api.openstack.org/api-ref.html#ext-os-server-start-stop This requires a dictionary in python as follows:
dict = {
os-start:null
}
Then I am doing a json.dumps(dict) and making a post request to the openstack's public URL for nova module.
When I run this program ,error of unknown global name "null". Hence, its not working.
I want to know for this request of starting the server on OpenStack to work , what should I use as the value of field "os-start" in request JSON.
Let me know if any additional information is needed.
Thank you in advance.
Python's None
singleton is translated to a JSON null
, and vice versa. Use that instead:
>>> import json
>>> json.dumps({'os-start': None})
'{"os-start": null}'
>>> json.loads('{"os-start": null}')
{u'os-start': None}