# How to consume a webservice Rest on BonitaSoft 7.4

**URL:** <https://community.ofelia.com/t/how-to-consume-a-webservice-rest-on-bonitasoft-7-4/8281>\
**Category:** Q&A\
**Created:** [9 March 2017 14:59 UTC](https://community.ofelia.com/t/how-to-consume-a-webservice-rest-on-bonitasoft-7-4/8281 "2017-03-09T14:59:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipe\_22](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@felipe\_22](https://community.ofelia.com/u/felipe_22)\
**Post date:** [9 March 2017 14:59 UTC](https://community.ofelia.com/t/how-to-consume-a-webservice-rest-on-bonitasoft-7-4/8281/1 "2017-03-09T14:59:54Z")

</div>

Hi people!

I’m trying to consume a webservice that I’d produces with an object like:{“tipo”:null,“servidor”:null,“cname”:null,“nome”:“[example.com](http://example.com)”,“ip”:“x.x.x.x”,“ip\_servidor”:null}

I’ve added the connector Rest and I’m configuring it. I can already do the GET and get the string. But how to extract the information and insert into the variables?

Thanks

Felipe Medeiros

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [14 March 2017 17:24 UTC](https://community.ofelia.com/t/how-to-consume-a-webservice-rest-on-bonitasoft-7-4/8281/2 "2017-03-14T17:24:04Z")

</div>

Hi,

Using the GET REST Connector, you should be able to manipulate the response as an object on the Output operations screen of the connector configuration. The output is called bodyAsObject. You can either store that object in a variable or write a Groovy script to modify it before storing it in a variable.

Cheers

---

<div class="post-metadata">

**Author:** ![felipe\_22](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@felipe\_22](https://community.ofelia.com/u/felipe_22)\
**Post date:** [17 March 2017 13:12 UTC](https://community.ofelia.com/t/how-to-consume-a-webservice-rest-on-bonitasoft-7-4/8281/3 "2017-03-17T13:12:49Z")

</div>

Hi Lionel Palacin,

Thanks for you answer! It´s exactly I’m trying to do!

In fact I need to know more about Groovy script as you just sayed. Could you help me with this?

For example, I want to get the properties nome and ip. So I tryed something like that:

myString = bodyAsObject.nome  
myString = bodyAsObject.ip

or I have to use a JsonSluper?

Thanks again!

---

<div class="post-metadata">

**Author:** ![felipe\_22](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@felipe\_22](https://community.ofelia.com/u/felipe_22)\
**Post date:** [21 March 2017 20:37 UTC](https://community.ofelia.com/t/how-to-consume-a-webservice-rest-on-bonitasoft-7-4/8281/4 "2017-03-21T20:37:48Z")

</div>

I tryed this script to get the object:

import groovy.json.JsonSlurper

def Dns = new JsonSlurper().parseText(bodyAsObject)

class Dns {  
String nome  
String ip  
String ip\_servidor  
String cname  
String tipo  
String servidor  
}

but I get this exception:

No signature of method: groovy.json.JsonSlurper.parseText() is applicable for argument types: (java.util.HashMap) values: [[servidor:null, tipo:null, ip\_servidor:null, ip:x.x.x.x, …]]  
Possible solutions: parseText(java.lang.String), parse([B), parse([C), parse(java.io.File), parse(java.io.InputStream), parse(java.io.Reader)
