This article helps with common issues when configuring REST API using the “Splunk REST API"
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:741)The error comes from the imported module httplib2, and it is displayed when the self-signed certificates cannot be verified by the certificate authority,
import urllib import httplib2 import time import re from time import localtime,strftime from xml.dom import minidom import json baseurl = 'https://hostname:8089' username = 'username' password = 'password' myhttp = httplib2.Http(disable_ssl_certificate_validation=True)
httplib2.SSLHandshakeError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:741)If getting this error, confirm the right port in the baseurl variable is used. For example, using 8000 in the script, instead of 8089:
baseurl = 'https://hostname.com:8000
baseurl = 'http://hostname.com:8089'
IndexError: list index out of rangeEven though the issue seems related to the search, confirm if the username and the password are correct, lines 9 and 10 will take the Splunk username and the password and put them into the username and the password variables.
username = 'admin' password = 'password1234'
/services/auth/login” or “/services/search/jobs”
Error in 'search' command: Unable to parse the search: Comparator '=' has an invalid term on the left hand side: index=sourcetype.
searchquery = 'index= sourcetype=internal | stats count by log_level'
disable_ssl_certificate_validation=True
index=_internal earliest=-15m latest=now | stats count by log_level
socket.error: [Errno 110] Connection timed out
~]$which python /usr/bin/python ~]$source /opt/splunk/bin/setSplunkEnv Tab-completion of "splunk " is available. ~]$which python /opt/splunk/bin/python
splunk-rest-api-is-easy-to-use.html
| Revision | Publish Date | Comments |
|---|---|---|
1.0 |
29-Sep-2026
|
Initial Release |