# Chaining GraphQL requests based on answer-body or variable

**URL:** <https://community.postman.com/t/chaining-graphql-requests-based-on-answer-body-or-variable/62700>\
**Category:** Help Hub\
**Tags:** graphql, if-else, chaining\
**Created:** [June 27, 2024, 8:04am UTC](https://community.postman.com/t/chaining-graphql-requests-based-on-answer-body-or-variable/62700 "2024-06-27T08:04:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joint-operations-as5](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@joint-operations-as5](https://community.postman.com/u/joint-operations-as5)\
**Post date:** [June 27, 2024, 8:04am UTC](https://community.postman.com/t/chaining-graphql-requests-based-on-answer-body-or-variable/62700/1 "2024-06-27T08:04:06Z")

</div>

Hello everyone,

I am currently trying to chain multiple GraphQL requests based on the answer-body of the first request. With my first request I request an authenticationToken. Then I want to check if I recived a token or not. Based on if I recived a token or not I want to either execute skript A or skript B.

My token looks like this if the request was succesful. If not instead of a token it will simply return “null”

{  
“data”: {  
“createAuthenticationToken”: {  
“authenticationToken”: “XXXXXXXX-XXXX-XXXX-XXXXXXXXXX”  
}  
}

I am already successfully saving my token into a variable using this after response skript  
pm.collectionVariables.set(“Current\_Token”, pm.response.data.createAuthenticationToken.authenticationToken);

How can I check my answer-body or my Current\_Token variable and execute a skript based on the value?

Thank you  
System Info bellow

Version11.2.13  
UI version 11.2.13-ui-240620-0532  
Desktop platform version 11.2.0  
Architecture x64  
OS platform win32 10.0.19045

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [July 27, 2024, 10:05am UTC](https://community.postman.com/t/chaining-graphql-requests-based-on-answer-body-or-variable/62700/3 "2024-07-27T10:05:48Z")

</div>

Closed on July 27, 2024, 10:05am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
