# How to get an element property value from an API response?

**URL:** <https://forum.katalon.com/t/how-to-get-an-element-property-value-from-an-api-response/36713>\
**Category:** API Testing\
**Tags:** api-testing, katalon-studio\
**Created:** [November 22, 2019, 10:18am UTC](https://forum.katalon.com/t/how-to-get-an-element-property-value-from-an-api-response/36713 "2019-11-22T10:18:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sang](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sang/32/6357_2.png) [@sang](https://forum.katalon.com/u/sang)\
**Post date:** [November 22, 2019, 10:41am UTC](https://forum.katalon.com/t/how-to-get-an-element-property-value-from-an-api-response/36713/2 "2019-11-22T10:41:07Z")

</div>

Hi [ravi.b23](http://forum.katalon.com/u/ravi.b23),

Please review this post for your needs. You can get the response data and assign to the global variable.

**Example script:**

> response = WS.sendRequest(findTestObject(‘Employees/Login backoffice and get access token’))  
> WS.verifyResponseStatusCode(response, 200)  
> JsonSlurper slurper = new JsonSlurper()  
> Map parsedJson = slurper.parseText(response.getResponseText())  
> String access\_token = parsedJson.access\_token  
> GlobalVariable.Token = access\_token

> [@Store AUTH TOKEN in Global Variable](http://forum.katalon.com/t/store-auth-token-in-global-variable/10743/6):
>
> Hi [Julian\_Wladyczynski](http://forum.katalon.com/u/Julian_Wladyczynski) Please retry by following this step: 1. Assigned access\_token value to the GlobalVariable response = WS.sendRequest(findTestObject('Employees/Login backoffice and get access token')) WS.verifyResponseStatusCode(response, 200) JsonSlurper slurper = new JsonSlurper() Map parsedJson = slurper.parseText(response.getResponseText()) String access\_token = parsedJson.access\_token GlobalVariable.Token = access\_token 2. On the GET request, set the Variable as below.

---

_[View the full topic](https://forum.katalon.com/t/how-to-get-an-element-property-value-from-an-api-response/36713)._
