Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API & Integration


NetMRI REST API - How to authenticate without using cookies

Posts: 36
3484     0


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?


HTTP Basic authentication

Posts: 353
3485     0

HTTP Basic authentication works as well. It's just slower, especially if it has to go out to AD for every call.



Indeed that works.

Posts: 36
3485     0

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.


Here is a sinppet from my

Posts: 422
3485     0

Here is a sinppet from my python code:


# -*- coding: utf-8 -*-

__author__ = 'Sif Baksh @ Infoblox'


import requests

import json


netmri = ""

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']:

                        print entry['DeviceName']


except (ValueError, KeyError, TypeError):

    print "JSON format error"

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh
Showing results for 
Search instead for 
Do you mean 

Recommended for You