Reputation: 504
I have been trying to create a node.js json request object. And i need to pass a parameter in middle of url path. I am giving the below however it is not working.. COuld you please help ?
var alertModel = {
method:'GET',
pathparam:{accountNum: '21703774771466'},
path:"/v1/note/sen/${accountNum}/notes",
qs:{
category:'NOTES'
}
}
Upvotes: 1
Views: 389
Reputation: 45019
You are using template literals with double quotes. Instead use backticks:
path: `/v1/note/sen/${accountNum}/notes`,
Upvotes: 1
Reputation: 1
Use backquote:
let accountNum=21703774771466;
var alertModel = {
method:'GET',
path:`/v1/note/sen/${accountNum}/notes`,
qs:{
category:'NOTES'
}
}
work with node.js >= 4.x.x
Upvotes: 0