Getting Data In

REST API - error "Invalid earliest_time."

jetzt82
Explorer

Use Splunk SDK JAVA, I'd use the REST API.
If the settings as follows causes an error.

code:

Args queryArgs = new Args();
queryArgs.put("earliest_time",  "8/21/2014:00:00:00");
queryArgs.put("latest_time",    "8/31/2014:23:59:59");

error:

[Fatal Error] :1:1: Unexpected end of file.
Exception in thread "main" com.splunk.HttpException: HTTP 400 -- <?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <msg type="FATAL">Invalid earliest_time.</msg>
  </messages>
</response>

at com.splunk.HttpException.create(HttpException.java:84)
at com.splunk.HttpService.send(HttpService.java:386)
at com.splunk.Service.send(Service.java:1268)
at com.splunk.HttpService.post(HttpService.java:243)
at com.splunk.JobCollection.create(JobCollection.java:81)
at Test01_02.Test01_02_01.main(Test01_02_01.java:59)

Are there any workaround for this?

Tags (3)
0 Karma

sklass
Path Finder

In poking through the returned data - when it did work it looks like the format should be.

YYYY-MM-DDTHH:MM:SS

Example: 2015-05-02T07:30:00

You can also append your timezone at the end as well. Really this is way harder than it should be.

richgalloway
SplunkTrust
SplunkTrust

The format of the time strings don't look right. Have you tried "8/31/2014T00:00:00"?

---
If this reply helps you, Karma would be appreciated.
0 Karma

jetzt82
Explorer

queryArgs.put("earliest_time", "8/21/2014T00:00:00");
queryArgs.put("latest_time", "8/31/2014T23:59:59");

The same error occurs.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...