I see that I can set the output_mode on a GET request to be JSON, but I'd like the same to happen with a POST. Currently it seems that if there is an error on a POST, it returns XML by default, ignoring the output_mode query string. ignoring the output_mode value in the body..
Here is some quick example code in python..
bsmith@bsmith-laptop!1095 S:0 M:command
-> python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib2
>>> import urllib
>>>
>>> http_obj = httplib2.Http()
>>> encoded_body = urllib.urlencode({'username':'admin', 'password':'WRONGPASSWORD', 'output_type': 'JSON'})
>>> response = http_obj.request('https://localhost:8089/services/auth/login',
... 'POST', headers={}, body=encoded_body)
>>>
>>> print response
({'status': '401', 'content-length': '81', 'server': 'Splunkd', 'connection': 'close', 'date': 'Fri, 30 Jul 2010 16:26:01 GMT', 'content-type': 'text/xml; charset=utf-8'}, '<response>\n<messages>\n<msg type="WARN">Login failed</msg>\n</messages>\n</response>')
Also, I wanted to mention that it would be really cool if you could specify an Accept header as opposed to a query string for output_mode.. It would go like this..
Accept: application/json
or
Accept: text/xml
... View more