Error code 500 when posting to search job API for the FIRST time to get job id
Hi Team,
I’m using an Enterprise Trial account.
I'm trying to access https://api.sumologic.com/api/v1/search/jobs to get a search job. Using Restlet Client version 2.6.0 in google chrome. with headers
Content-Type:application/json
Accept:application/json
Authorization: Basic <base 64 encoding of <accessId>:<accessKey>>
I created the access key using account -> Preferences -> My Access Keys
And encoded the pair <accessId>:<accessKey> using https://www.base64encode.org/
And request send with query params
query : | count _sourceCategory
from : 2017-07-01T12:00:00
to : 2017-07-19T23:10:00
timeZone : PST
And after executing,
but the response is
{
"status": 500,
"id": "ZFIQD-78R90-BB6QP",
"code": "internal.error",
"message": "Internal server error."
}
Actual URL : https://api.us2.sumologic.com/api/v1/search/jobs?query=| count _sourceCategory&from=2017-07-01T12:00:00&to=2017-07-19T23:10:00&timeZone=PST
Can you help me resolve this issue.
-
As it says we need to send 4 query parameters in the request. So first I append those to the url looked like the one in the bottom of the question.
Actual URL : https://api.us2.sumologic.com/api/v1/search/jobs?query=| count _sourceCategory&from=2017-07-01T12:00:00&to=2017-07-19T23:10:00&timeZone=PST
But it didn't work out so I tried to send a json in the request body with content-type 'application/json' . In your sample POST you have a
createSearchJob.json
which has content like,
{ "query": "| count _sourceCategory", "from": "2013-01-28T12:00:00", "to": "2013-01-28T13:10:00", "timeZone": "PST" }
So I set the same in the content body which apparently worked for me ,
And I got a 202 and got your response with a jobID and a link like you described in the documentation.
And also now I can page through the messages as well.
https://api.sumologic.com/api/v1/search/jobs/SEARCH_JOB_ID/records?offset=OFFSET&limit=LIMIT
is working now.
All those got resolved through Restlet client in Chrome. Now have to replicate that in a custom environment.
Please sign in to leave a comment.
Comments
3 comments