All Apps and Add-ons

REST API Modular Input: How can I make REST calls to MS Project Server 2013?

andrewtrobec
Motivator

Hello,

I am busy trying to configure the REST API Modular Input to make a REST call to my MS Project Server 2013 instance, but I'm not exactly sure how to configure the form and Custom Authentication Handler. I have a piece of Python code that authenticates me and makes a request to the URL that I want to retrieve data from:

import requests
from ntlm import HTTPNtlmAuthHandler
import getpass
import urllib2

SITE = "https://<MSPS_Server>/<Site>/"
USERNAME = "domain\\username"
PASSWORD = "<password>"

passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, SITE, USERNAME, PASSWORD)
auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
opener = urllib2.build_opener(auth_NTLM)
urllib2.install_opener(opener)

URL = "https://<MSPS_Server>/<Site>/_api/ProjectData/Resources?$select=ResourceId,ResourceName"
response = urllib2.urlopen(URL)
headers = response.info()
print("headers: {}".format(headers))
body = response.read()
print("response: " + body)

What I am having trouble with is figuring out how to modify the authhandlers.py file for authentication and what to put in the Endpoint URL field in the configuration form.

Any pointers would be greatly appreciated!

Thank you,

Andrew

jpvalenc
Path Finder

Were you able to figure it out?

0 Karma

jkat54
SplunkTrust
SplunkTrust

The rest api modular input is for calling Splunks api and putting data into splunk.

It's not for calling external apis.

However I have created a curl search command (shameless self promotion). It will allow you to post/get from external apis but it isn't perfect and is technically beta now. You'll find it in the jkats toolkit app on splunkbase.

To index the data into splunk you'd have to use the collect command after the curl command.

Looking at your script however, you may just want to use your script as a scripted input. Check out scripted inputs in the inputs.conf documentation for instructions on how to call your script as an input.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...