Splunk Search

Curl with dynamic url not working

palak_247
Observer

I am trying to make a curl request to a direct json link and fetch the result. When i hardcode the URL it works fine but my url is dynamic and gets created based on the search result of another query.

I can see my curl command is correct but it doesnt give proper output

Labels (1)
0 Karma

palak_247
Observer

I have a search query S1 which gives me a result  X with numeric values (203, 204, 205) and  I am able to populate this in a table. Now I want to bind this number with a url to create a dynamic url specific to that number.
For example URL is https://cnac.ca/data/json/npas.json  and from S1 query i get the result value as 203, I want to create URL : https://cnac.ca/data/json/npa203.json and want to hit this to get the response back to get the required data. 

For this I am using curl command, but when I try to create a dynamic URL and pass it in curl command it doesn't accept it.

Please suggest.

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Standard SPL doesn't have a curl command.  You should ask the developer who developed the app that gives you curl, or consult its manual to find out the correct syntax and any limitations it may have. (Given that "Apps and Add-ons" forum is gone from this board, Splunk Dev might be a successor.)

Also, you talk about "dynamic url" as if it is a Splunk feature.  It is not.  Maybe you can illustrate your SPL snippet so volunteers can understand precisely what you are referring to?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Please can you provide a more detailed example of the issue you are facing (anonymising sensitive information such as ip addresses etc.)

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!

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...