# Getting error when using variable in JSON request

**URL:** <https://community.postman.com/t/getting-error-when-using-variable-in-json-request/68078>\
**Category:** Help Hub\
**Tags:** variables, json, just-getting-started\
**Created:** [September 5, 2024, 5:25pm UTC](https://community.postman.com/t/getting-error-when-using-variable-in-json-request/68078 "2024-09-05T17:25:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvacon](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jvacon](https://community.postman.com/u/jvacon)\
**Post date:** [September 5, 2024, 5:25pm UTC](https://community.postman.com/t/getting-error-when-using-variable-in-json-request/68078/1 "2024-09-05T17:25:16Z")

</div>

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 😛

In a previous topic question, I asked [How to store the response body as a JSON variable?](https://community.postman.com/t/how-to-store-the-response-body-as-a-json-variable/68071) 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”  
> }  
> }

---

<div class="post-metadata">

**Author:** ![jvacon](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jvacon](https://community.postman.com/u/jvacon)\
**Post date:** [September 5, 2024, 5:28pm UTC](https://community.postman.com/t/getting-error-when-using-variable-in-json-request/68078/2 "2024-09-05T17:28:32Z")

</div>

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](https://www.postman.com/postman/postman-answers/documentation/3f84fem/add-variable-to-json-body)

---

<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:** [September 8, 2024, 5:29pm UTC](https://community.postman.com/t/getting-error-when-using-variable-in-json-request/68078/3 "2024-09-08T17:29:18Z")

</div>

Closed on September 8, 2024, 5:29pm UTC

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