1 pièce(s) jointe(s)
Problème format JSON non-conforme en sortie (Curl - JSON - tREST - TALEND)
Bonjour,
J'ai un composant "tREST" que je lie à un composant tJSONoutput
Dans le tREST je met en place une requere cURL, la requete demande une URL et un "X-Auth-Token" en entête HTTP
Suite à cela je récuperer un JSON qui contient toutes les metriques de mes infrasctructures présente sur openstack
le soucis est que le json n'est pas au bon format, c'est un gros paquet de donnée non structuré au format JSON .
La solution est de rajouter " | python -mjson.tool " à la fin de la requete cURL .
Comme ceci : curl -H "X-Auth-Token:XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXX/servers/detail " | python -mjson.tool
Ceci fonctionne tres bien sur la console bash github , mais je voudrais l'utiliser sur TALEND afin que mon tREST interoge openstack et genere un JSON au BON FORMAT .
Merci de votre aide ...
*************************************************************
Hello,
I have a "tREST" component that I link to a tJSONoutput component
In the tREST I set up a cURL request, the request requests a URL and an "X-Auth-Token" in HTTP header
After that I get a JSON that contains all the metrics of my infrastructures on openstack
the concern is that the json is not the right format, it's a big package of unstructured data in JSON format.
The solution is to add "| python -mjson.tool" at the end of the cURL request.
Like this: curl -H "X-Auth-Token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXX / servers / detail" | python -mjson.tool
This works very well on the bash github console, but I would like to use it on TALEND so that my tREST interopts openstack and generates a JSON with the GOOD FORMAT.
Thank you for your help ...
Pièce jointe 350582
Ahmed DAOUDI.