All Apps and Add-ons

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

andrewtrobec
Builder

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!

Using Machine Learning for Hunting Security Threats

WATCH NOW Seeing the exponential hike in global cyber threat spectrum, organizations are now striving more for ...

Observability Newsletter Highlights | March 2023

 March 2023 | Check out the latest and greatestSplunk APM's New Tag Filter ExperienceSplunk APM has updated ...

Security Newsletter Updates | March 2023

 March 2023 | Check out the latest and greatestUnify Your Security Operations with Splunk Mission Control The ...