I need to send the request with the following body:
{
"repository": {
"relatedId": 25,
"name": "somename",
"order": 0
}
}
I already have collection variable with number value for relatedId. How do I use it?
If I do it this way, I get value for related id as string, which is not what I need:
{
"repository": {
"relatedId": "{{receivedRelatedId}}", // becomes "relatedId": "25", and I need "relatedId": 25
"name": "somename",
"order": 0
}
}
Without quotes I get parsing errors:
{
"repository": {
"relatedId": {{receivedRelatedId}},
"name": "somename",
"order": 0
}
}
How do I properly use numeric variable value?
You need to do this without quotes.
What parsing error are you receiving?
{
"repository": {
"relatedId": {{relatedID}},
"name": "somename",
"order": 0
}
}
Posting this to Postman echo works fine and the integer is showing ok.
{
"args": {},
"data": {
"repository": {
"relatedId": 25,
"name": "somename",
"order": 0
}
},
"files": {},
"form": {},
"headers": {
"x-forwarded-proto": "https",
"x-forwarded-port": "443",
"host": "postman-echo.com",
"x-amzn-trace-id": "Root=1-6399a19a-6f6f5e1a2e11db8e5ef2b7a0",
"content-length": "104",
"content-type": "application/json",
"user-agent": "PostmanRuntime/7.29.2",
"accept": "*/*",
"cache-control": "no-cache",
"postman-token": "063a1fb3-18ae-4b37-80b5-5dac76683a43",
"accept-encoding": "gzip, deflate, br",
"cookie": "sails.sid=s%3AZuwUykb7qIFcMZzu5EcP3C-u3aXz3Now.RlSP%2FSVQVgN0%2FYzyQBrcWtgMt6HBcpFVz8adH7xtUWQ"
},
"json": {
"repository": {
"relatedId": 25,
"name": "somename",
"order": 0
}
},
"url": "https://postman-echo.com/post"
}
Error seems to be gone without me changing anything, now without quotes it works. Thanks for the reply!