maas post returns "BAD request error"
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | MAAS |
Undecided
|
Unassigned | ||
Bug Description
I am trying to execute a post request on MAAS.
That is what I need to do here is have to POST some details to MAAS using MAAS API.
So that I have followed the MAAS API documentation.
Using the same I can be able to process GET requests.
In the mean time when I am attempting to do a POST request I am getting error as follows:
<pre>
File "vag_1.py", line 105, in <module>
maas_
File "/usr/lib/
url, method="POST", headers=headers, data=body)
File "/usr/lib/
res = urllib2.
File "/usr/lib/
return _opener.open(url, data, timeout)
File "/usr/lib/
response = meth(req, response)
File "/usr/lib/
'http', request, response, code, msg, hdrs)
File "/usr/lib/
return self._call_
File "/usr/lib/
result = func(*args)
File "/usr/lib/
raise HTTPError(
urllib2.HTTPError: HTTP Error 400: BAD REQUEST.
</pre>
My code for post is as follows:
<pre>
argument_parser = argparse.
argument_
argument_
argument_
argument_
params = {"username": "newuser", "email": "<email address hidden>", "password": "newuser", "is_superuser": "1"}
maas_access.
</pre>
What I am doing wrong here.
Please let me know the proper way for doing the same.
Atleast provide with me any proper logs to trace the same.
| description: | updated |
| muralidharan (muraliselva-10) wrote : | #1 |
| Mike Pontillo (mpontillo) wrote : | #2 |
Thanks for your interest in MAAS.
Unfortunately, the bug tracker is not the appropriate venue to discuss this type of support request.
I suggest you use Wireshark (or a similar tool) to compare the results from the "maas" CLI command with the results of your script. (Or simply use the "maas" command directly.)
| Changed in maas: | |
| status: | New → Invalid |
| muralidharan (muraliselva-10) wrote : | #3 |
Ok then where should I reach to discuss above issue.
| Mike Pontillo (mpontillo) wrote : | #4 |
You might try stackoverflow and/or askubuntu, but they will most likely expect you to do more research to fully narrow down the issue before asking for help. Again, I would use Wireshark to compare the POST request from the (already working) 'maas' CLI command to that which your code generates. Also, you can find the source code for the official MAAS CLI here:
https:/
I will not be able to provide further assistance on this bug. Good luck!


I can get the correct result for normal POST without data.
For the following request:
# creating authorization token post(u" account/ ", "create_ authorisation_ token")
maas_access.
But in case of POST request like above I amalways getting an error