Chaining GraphQL requests based on answer-body or variable

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

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