Splunk Cloud

Search Reference

Download manual as PDF

Download topic as PDF



The rest command reads a Splunk REST API endpoint and returns the resource data as a search result.


| rest <rest-uri> [count=<int>] [splunk_server=<wc-string>] [splunk_server_group=<wc-string>]... [timeout=<int>] (<get-arg-name>=<get-arg-value>)...

Required arguments

Syntax: <uri>
Description: URI path to the Splunk REST API endpoint.
Syntax: <string>
Description: REST argument name.
Syntax: <string>
Description: REST argument value.

Optional arguments

Syntax: count=<int>
Description: Limits the number of results returned. When count=0, there is no limit.
Default: 0
Syntax: splunk_server=<wc-string>
Description: Specifies the distributed search peer from which to return results. You can specify only one splunk_server argument, However, you can use a wildcard character when you specify the server name to indicate multiple servers. For example, you can specify splunk_server=peer01 or splunk_server=peer*. Use local to refer to the search head.
Default: All configured search peers return information
Syntax: splunk_server_group=<wc-string>...
Description: Limits the results to one or more server groups. You can specify a wildcard character in the string to indicate multiple server groups.
Syntax: timeout=<int>
Description: Specify the timeout in seconds when waiting for the REST endpoint to respond.
Default: 60


The rest command authenticates using the ID of the person that runs the command.

For more information, see the REST API User Manual.


Example 1: Access saved search jobs.

| rest /services/search/jobs count=0 splunk_server=local | search isSaved=1

Example 2: Add current search user to all events (useful for creating reports that only show events associated with logged in user).

* | head 10 | join [ | rest splunk_server=local /services/authentication/current-context | rename username as auth_user_id | fields auth_user_id ]


Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has about using the rest command.


This documentation applies to the following versions of Splunk Cloud: 7.0.0, 6.5.0, 6.5.1, 6.5.1612, 6.6.0, 6.6.1, 6.6.3

Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters