how we do post in maas-api (1.8.2)

Asked by Binoy M V on 2015-09-30

How to do post in maas-api with version 1.8.2
Get is working fine. When i try to get the details from the api, it got success. But in case of user and other post it is notworking.

I tried with SSh key it seems working with the following code

sshKeys = {"key": [keyValue]}
#Creating the sshkey"account/prefs/sshkeys/", "new", **sshKeys)

But in case of user, zones etc seems not working.

from apiclient import maas_client
maas_access = maas_client.MAASClient(maas_client.MAASOAuth(*APIKEY.split(":")), maas_client.MAASDispatcher(), MAAS_URL)
keyAndData = {"name": "defaulttest", "description": "test"}"zones/", 'new', **keyAndData)

File "/usr/lib/python2.7/dist-packages/apiclient/", line 250, in post
    url, method="POST", headers=headers, data=body)
  File "/usr/lib/python2.7/dist-packages/apiclient/", line 116, in dispatch_query
    res = urllib2.urlopen(req)
  File "/usr/lib/python2.7/", line 127, in urlopen
    return, data, timeout)
  File "/usr/lib/python2.7/", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/", line 448, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/", line 539, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: BAD REQUEST

I don't know what i am doing wrong. Please help me on this.

Question information

English Edit question
Ubuntu maas Edit question
No assignee Edit question
Last query:
Last reply:
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.