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.