08-13-2015 01:12 AM
We're busy setting up syncronisation between one of our databases and the list feature of NetMRI to push some info about our locations so we can use it in our script. For this we use the REST API of NetMRI because it's the only way to interface with the system from outside. But we bump into an issue here. The tool we're using (PowerCenter from Informatica) doesn't support the way of authenticating in NetMRI. It can't call /api/authenticate before doing other calls because it can't handle the cookies that are returned. (It handles REST as being stateless)
Are there any undocumented ways to authenticate?
Can we pass headers or fields in every REST call to authenticate? Like basic authentication HTTP headers for example? Or maybe even a client certificate?
08-16-2015 11:52 PM
Indeed that works.
I tested it before but a browser appears to only send the basic authentication header when he receives a challenge. The same with WGET, you have to add the --auth-no-challenge option to force it so send the header.
08-21-2015 11:11 AM
Here is a sinppet from my python code:
# -*- coding: utf-8 -*-
__author__ = 'Sif Baksh @ Infoblox'
netmri = "10.10.10.1"
username = "sifbaksh"
password = "testpw"
url = "https://"
object_type = "/api/2.6/devices/index"
data = requests.get(url + netmri + object_type, verify=False, auth=(username, password))
json_input = data.text
decoded = json.loads(json_input)
for entry in decoded['devices']:
except (ValueError, KeyError, TypeError):
print "JSON format error"