Hi Daniel, Make sure you're sending the 'Accept: application/json' header with each request
On Thu, 16 Nov 2017 at 16:17 Daniel Souza <[email protected]> wrote: > Hello, > > Now everything works fine, but I still have a doubt. Some requests like > "?op=mark_broken" and "?op=deploy" return only XML instead of JSON. Do you > know if there is any way to return only JSON? > > Thank you! > > Em 14/11/2017 16:54, Daniel Souza escreveu: > > I Mike, thank you a lot! > Em 14/11/2017 16:32, Mike Pontillo escreveu: > > Hi Daniel, > > On Tue, Nov 14, 2017 at 10:11 AM, Daniel Souza < > [email protected]> wrote: > >> I have a scrip that authenticate to MAAS API 2.0 and execute the request, >> then, I have tried: >> >> rubytesteapi.rb "/machines/{system_id}/?op=commission" "{skip_networking: >> *'1'*}" >> or >> rubytesteapi.rb "/machines/{system_id}/?op=commission" "{skip_networking:* >> 1*}" >> or >> rubytesteapi.rb /machines/{system_id}/?op=commission&*skip_networking=1* >> >> The same script works to other requests. I need to keep the node's >> network config when commissioning, that is why I am using >> "skip_networking". If I use MAAS CLI, this works fine "commission >> {system_id} skip_networking=1", but through API it doesn't work. >> >> Does someone know the correct way to use this parameter? >> > The MAAS API generally uses GET requests for reading and POST requests for > writing. My guess is that passing the parameters on the URL string instead > of the body of the POST request is causing this issue. > > I also encourage you to look at our Python API, available here: > > https://github.com/maas/python-libmaas > > You might find it easier to use it directly, or you may find examples here > of the types of things you want to do. > > Regards, > Mike > > > Daniel Batista, Cloud Computing Specialist - DevOps > <http://maxihost.com.br/> > +55-4933-7591 <+55-4020-9739> > www.maxihost.com.br <http://maxihost.com.br/> > > > > > Daniel Batista, Cloud Computing Specialist - DevOps > <http://maxihost.com.br/> > +55-4933-7591 <+55-4020-9739> > www.maxihost.com.br <http://maxihost.com.br/> > > > -- > Maas-devel mailing list > [email protected] > Modify settings or unsubscribe at: > https://lists.ubuntu.com/mailman/listinfo/maas-devel >
-- Maas-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/maas-devel
