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
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...