Getting error when using variable in JSON request

Hi Folks!

I’m new to Postman and I have no sweet clue about coding. The only thing I kind of know is Excel VBA :stuck_out_tongue:

In a previous topic question, I asked How to store the response body as a JSON variable? and it’s a follow-up to it, but separating it since it might be someone else that’s new doesn’t know how to do.

My variable is named varconnectionID
(In my previous topic post I named in connectionID, but when making this new request I realized that I was using confusing naming conventions)

I’m trying to use the collection variable made in a previous request in a new request but the response is indicating that variable doesn’t exist.

Any ideas?

Thanks in advance!

Main Call

{
“arguments”:{
“count”:“50”,
“startIndex”:“100”,
“connectionID”:varconnectionID,
“includeRoleMembership”:“true”
},
“methodName”:“getAllUsers”,
“serviceName”:“UserService”
}

But my response is

{
“error”: {
“message”: “variable [varconnectionID] doesn’t exist”,
“type”: “expression”
}
}

Replying to myself since I just figured it out.

Need to reference variable like this

“{{varconnectionID}}”

{
“arguments”:{
“count”:“50”,
“startIndex”:“100”,
“connectionID”:“{{varconnectionID}}”,
“includeRoleMembership”:“true”
},
“methodName”:“getAllUsers”,
“serviceName”:“UserService”
}

If following along, I found this post that made me do the “AH HA!” moment.

https://www.postman.com/postman/postman-answers/documentation/3f84fem/add-variable-to-json-body

1 Like

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