Re: [Freeipa-users] JSON interface
On 03/07/2014 05:31 PM, Erinn Looney-Triggs wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/07/2014 08:57 AM, Petr Viktorin wrote: On 03/07/2014 04:34 PM, Rich Megginson wrote: [...] The ipa command line tools use RPC, but they use XML. If you run ipa -vv dnsrecord-add ... you can see the XML sent and received. There is a bit of work converting from XML to JSON. e.g. testdomain.com.testdomain.com is ["testdomain.com.", "testdomain.com."] [...] Note that FreeIPA 4.0 (current git master) will use JSON-RPC by default, so you'll no longer need to convert from XML. It seems the -vv option is quickly becoming very useful for API users. Currently the logging is very low-level; [...] Would it be useful to also log pretty-printed JSON with `-vvv`, so adventurous API explorers can just copy and paste? Umm, yes please! Filed as: https://fedorahosted.org/freeipa/ticket/4233 To the ticket I attached a crude patch I've been using; it can act as a starting point if someone wants to jump on this. -- PetrĀ³ ___ Freeipa-users mailing list Freeipa-users@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-users
Re: [Freeipa-users] JSON interface (Was: IPA DNS command line tools and ~)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/07/2014 08:57 AM, Petr Viktorin wrote: > On 03/07/2014 04:34 PM, Rich Megginson wrote: [...] >> The ipa command line tools use RPC, but they use XML. If you run >> ipa -vv dnsrecord-add ... you can see the XML sent and received. >> There is a bit of work converting from XML to JSON. e.g. >> testdomain.com.testdomain.com >> >> is > ["testdomain.com.", "testdomain.com."] [...] > > Note that FreeIPA 4.0 (current git master) will use JSON-RPC by > default, so you'll no longer need to convert from XML. > > > > > It seems the -vv option is quickly becoming very useful for API > users. Currently the logging is very low-level; in current master I > get: > > $ ipa -vv ping ipa: INFO: trying > https://vm-244.idm.lab.eng.brq.redhat.com/ipa/session/json ipa: > INFO: Forwarding 'ping' to json server > 'https://vm-244.idm.lab.eng.brq.redhat.com/ipa/session/json' send: > u'POST /ipa/session/json HTTP/1.1\r\nHost: > vm-244.idm.lab.eng.brq.redhat.com\r\nAccept-Encoding: > gzip\r\nAccept-Language: en-us\r\nReferer: > https://vm-244.idm.lab.eng.brq.redhat.com/ipa/xml\r\nCookie: > ipa_session=da66695e0c3a772a3fe649c3e1d11612;\r\nUser-Agent: > xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: > application/json\r\nContent-Length: 64\r\n\r\n{"params": [[], > {"version": "2.77"}], "method": "ping", "id": 0}' reply: 'HTTP/1.1 > 200 Success\r\n' header: Date: Fri, 07 Mar 2014 15:48:31 GMT > header: Server: Apache/2.4.6 (Fedora) mod_auth_kerb/5.4 > mod_nss/2.4.6 NSS/3.15.3 Basic ECC mod_wsgi/3.4 Python/2.7.5 > header: Set-Cookie: ipa_session=da66695e0c3a772a3fe649c3e1d11612; > Domain=vm-244.idm.lab.eng.brq.redhat.com; Path=/ipa; Expires=Fri, > 07 Mar 2014 16:08:31 GMT; Secure; HttpOnly header: Vary: > Accept-Encoding header: Content-Encoding: gzip header: > Content-Length: 176 header: Content-Type: application/json; > charset=utf-8 body: '{\n"error": null, \n"id": 0, \n > "principal": "ad...@idm.lab.eng.brq.redhat.com", \n"result": > {\n "summary": "IPA server version 3.3.90GITcb4dcd8. API version > 2.77"\n }, \n"version": "3.3.90GITcb4dcd8"\n}' > - IPA server > version 3.3.90GITcb4dcd8. API version 2.77 > - > > Would it be useful to also log pretty-printed JSON with `-vvv`, so > adventurous API explorers can just copy and paste? > > Umm, yes please! - -Erinn -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQEcBAEBAgAGBQJTGfRMAAoJEFg7BmJL2iPOUxkH/jk0mRZugXGbYVFyKxBRflfa 1VSbqPt91kUdruePkD9frixl8PCZAm/p32BjPNR/S7j8t2S0r7INMDyDIM08gu4v ZXlTl6i46WUdnDWExeOqX6Cg4PV3DXThcEsGq/bFQ2rFoIw84ehkD5EV3b1lw3dw ybKphlwi68+9ks6588s1HeQQYUzixNcFNE+/I0yXdI8lga0xnob5m6EixVYR+FOH kwB4KWr8JXRPJMq+qtpRPoUNspFtTHoQxGU2M3qSBJ/QmkK05cFVVA+viqvgKdJ/ zF7tZXc15QxDXI3yqkEnqClet8CU6PplUK3ma6BjPm5yznI/TiiXb1g8YA97Qks= =GiYE -END PGP SIGNATURE- ___ Freeipa-users mailing list Freeipa-users@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-users
Re: [Freeipa-users] JSON interface (Was: IPA DNS command line tools and ~)
On 03/07/2014 04:34 PM, Rich Megginson wrote: [...] The ipa command line tools use RPC, but they use XML. If you run ipa -vv dnsrecord-add ... you can see the XML sent and received. There is a bit of work converting from XML to JSON. e.g. testdomain.com.testdomain.com is ["testdomain.com.", "testdomain.com."] [...] Note that FreeIPA 4.0 (current git master) will use JSON-RPC by default, so you'll no longer need to convert from XML. It seems the -vv option is quickly becoming very useful for API users. Currently the logging is very low-level; in current master I get: $ ipa -vv ping ipa: INFO: trying https://vm-244.idm.lab.eng.brq.redhat.com/ipa/session/json ipa: INFO: Forwarding 'ping' to json server 'https://vm-244.idm.lab.eng.brq.redhat.com/ipa/session/json' send: u'POST /ipa/session/json HTTP/1.1\r\nHost: vm-244.idm.lab.eng.brq.redhat.com\r\nAccept-Encoding: gzip\r\nAccept-Language: en-us\r\nReferer: https://vm-244.idm.lab.eng.brq.redhat.com/ipa/xml\r\nCookie: ipa_session=da66695e0c3a772a3fe649c3e1d11612;\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: application/json\r\nContent-Length: 64\r\n\r\n{"params": [[], {"version": "2.77"}], "method": "ping", "id": 0}' reply: 'HTTP/1.1 200 Success\r\n' header: Date: Fri, 07 Mar 2014 15:48:31 GMT header: Server: Apache/2.4.6 (Fedora) mod_auth_kerb/5.4 mod_nss/2.4.6 NSS/3.15.3 Basic ECC mod_wsgi/3.4 Python/2.7.5 header: Set-Cookie: ipa_session=da66695e0c3a772a3fe649c3e1d11612; Domain=vm-244.idm.lab.eng.brq.redhat.com; Path=/ipa; Expires=Fri, 07 Mar 2014 16:08:31 GMT; Secure; HttpOnly header: Vary: Accept-Encoding header: Content-Encoding: gzip header: Content-Length: 176 header: Content-Type: application/json; charset=utf-8 body: '{\n"error": null, \n"id": 0, \n"principal": "ad...@idm.lab.eng.brq.redhat.com", \n"result": {\n "summary": "IPA server version 3.3.90GITcb4dcd8. API version 2.77"\n }, \n"version": "3.3.90GITcb4dcd8"\n}' - IPA server version 3.3.90GITcb4dcd8. API version 2.77 - Would it be useful to also log pretty-printed JSON with `-vvv`, so adventurous API explorers can just copy and paste? -- PetrĀ³ ___ Freeipa-users mailing list Freeipa-users@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-users