Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Cloudera manager API json response as one line

Highlighted

Cloudera manager API json response as one line

Super Collaborator

Hi Guys,

 

I'm working to send the yarn applications meta data using the API to kibana,

 

But the API json response is pretty and kibana accepts the json as one line.

 

Below is one of the example i do, can anyone help me to know how to get this as one line?

 

curl -u 'xxxxx:'xxxxx' 'http://svvr-cmc101.lpdomain.com:7180/api/v11/clusters/cluster/services/yarn/yarnApplications?from=20...)'

1 REPLY 1

Re: Cloudera manager API json response as one line

Super Collaborator

Workaround would be to parse it in python/bash(tr,awk,sed)/perl to remove the line breaks, an easier option is to use ./jq -c -- see [0]

 

curl -s -X GET -u xxxxx:xxxxx http://cm-server:7180/api/v11/.... | jq -c

 

[0] https://stedolan.github.io/jq/manual/#Invokingjq

--compact-output / -c:

By default, jq pretty-prints JSON output. 
Using this option will result in more compact output by
instead putting each JSON object on a single line.