Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

How to parse REST requests results ?

$
0
0

Hello,

 

I created a workflow to automatise the creation of a vm and his configuration under RedHat Satellite. In order to make the RedHat Satellite configuration, I need to run a REST request (with GET method) and then I have to parse the results but I don't find the way to do this.

 

The request.execute() method that I use have no function available to parse the results. The only method that I find "usefull" is contentAsString but it return a string.

 

Could you help me to solve this ?

 

Here is an example of the contentAsString results, I need to get the id result :

  1. {
  2.     "total": 61,
  3.     "subtotal": 1,
  4.     "page": 1,
  5.     "per_page": 20,
  6.     "search": "GP-PROD-CentOs-7.2",
  7.     "sort":
  8.     {
  9.         "by": null,
  10.         "order": null
  11.     },
  12.     "results":
  13.     [
  14.         {
  15.             "subnet_id": null,
  16.             "subnet_name": null,
  17.             "operatingsystem_id": 23,
  18.             "operatingsystem_name": "CentOS 7.2",
  19.             "domain_id": 1,
  20.             "domain_name": "si.francetv.fr",
  21.             "environment_id": 35,
  22.             "environment_name": "KT_Default_Organization_Library_VUE_CentOS_7_2_25",
  23.             "compute_profile_id": 1,
  24.             "compute_profile_name": "1-Profile_de_VM-Petite",
  25.             "ancestry": null,
  26.             "parent_id": null,
  27.             "parent_name": null,
  28.             "puppet_proxy_id": 1,
  29.             "puppet_ca_proxy_id": 1,
  30.             "ptable_id": 108,
  31.             "ptable_name": "FTV Disk Layout CentOS",
  32.             "medium_id": 19,
  33.             "medium_name": "CentOs 7.2",
  34.             "architecture_id": 1,
  35.             "architecture_name": "x86_64",
  36.             "realm_id": null,
  37.             "realm_name": null,
  38.             "created_at": "2016-05-02 15:18:44 UTC",
  39.             "updated_at": "2016-10-19 13:51:43 UTC",
  40.             "id": 56,
  41.             "name": "GP-PROD-CentOs-7.2",
  42.             "title": "GP-PROD-CentOs-7.2"
  43.         }
  44.     ]
  45. }

Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>