REST API: basic login and config requests
setTimeout 120000
comment Verify unauthorized state
openAndWait /logout
openAndWait /v3/prefs/get?apikey=badkey
verifyAttribute //envelope/messages/msg/@type ERROR
comment login via REST; first bad, then good credentials
openAndWait /v3/auth/getToken?usr=admin&pwd=badpasswordhere
verifyElementNotPresent //envelope/authToken
verifyAttribute //envelope/messages/msg/@type ERROR
openAndWait /v3/auth/getToken?usr=admin&pwd=changeme
assertElementPresent //envelope/authToken
storeText //envelope/authToken localApiKey
comment get preferences and config
openAndWait /v3/prefs/get?apikey=${localApiKey}
verifyElementPresent //envelope/prefs/pref[@key='_raw']
verifyElementPresent //envelope/prefs/pref[@key='format']
openAndWait /v3/config/get?apikey=${localApiKey}
verifyElementPresent //envelope/config/events
verifyElementPresent //envelope/config/instanceName
comment run basic search
openAndWait /v3/splunk/search?apikey=${localApiKey}&q=page%200-2%2010000%20[%20search%20source%3D%22*apache.error.log%22%20]%20|%20outputxml%20format::raw
verifyText //envelope/searchResults/command page 0-2 10000 [ search source="*apache.error.log" ] | outputxml format::raw
verifyText //envelope/searchResults/results/r[2]/v [Sun Aug 7 12:19:36 2005] [error] [client 10.1.1.015] File does not exist: /home/reba/public_html/images/bullet_image.gif
comment run bad search
openAndWait /v3/splunk/search?apikey=${localApiKey}&q=page%200-2%2010000%20[%20badoperator%20]%20|%20outputxml%20format::raw
verifyAttribute //envelope/messages/msg/@type ERROR
verifyText //envelope/messages/msg *badoperator*