All Apps and Add-ons

REST API Modular Input: Why am I unable to pull API data from this site with my current curl command?

ankumar_juniper
Explorer

I am trying to pull some API data from Site24x7 site. My curl command is as below. I have input these values in REST API Modular Input, but still not getting any data. Mostly I am suspecting the http header properties I am passing. Please help?

curl  "https://www.site24x7.com/api/reports/sla_reports/availability?period={1}" \
                   -X GET -H "Accept: application/json; version=2.0" \
                   -H "Authorization: Zoho-authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

alt text

0 Karma
1 Solution

Damien_Dallimor
Ultra Champion

Your CURL command has 2 headers defined , and in the stanza you’ve turned this into 3 delimited headers.

So try (notice the “;” after json)

Accept=application/json; version=2.0,Authorization=Zoho-authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Any errors are in the logs.

Searchable with …….. index=_internal error ExecProcessor rest.py

View solution in original post

0 Karma

Damien_Dallimor
Ultra Champion

Your CURL command has 2 headers defined , and in the stanza you’ve turned this into 3 delimited headers.

So try (notice the “;” after json)

Accept=application/json; version=2.0,Authorization=Zoho-authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Any errors are in the logs.

Searchable with …….. index=_internal error ExecProcessor rest.py

0 Karma

ankumar_juniper
Explorer

Hi Damien,

I am seeing bad request error in the logs, I am still

09-14-2016 20:21:59.874 -0700 ERROR ExecProcessor - message from "python /data/splunk/etc/apps/rest_ta/bin/rest.py" HTTP Request error: 400 Client Error: Bad Request

HTTP Header Properties:

Accept= application/json; version=2.0,Authorization= Zoho-authtoken xxxxxxxxxxxxxxxxxx

Also tried below, Works in curl, but getting bad request from this app.

Accept= application/json,Authorization= Zoho-authtoken xxxxxxxxxxxxxxxxxx
0 Karma
Get Updates on the Splunk Community!

From Alert to Resolution: How Splunk Observability Helps SREs Navigate Critical ...

It's 3:17 AM, and your phone buzzes with an urgent alert. Wire transfer processing times have spiked, and ...

ATTENTION!! We’re MOVING (not really)

Hey, all! In an effort to keep this Slack workspace secure and also to make our new members' experience easy, ...

Splunk Admins: Build a Smarter Stack with These Must-See .conf25 Sessions

  Whether you're running a complex Splunk deployment or just getting your bearings as a new admin, .conf25 ...