I'm trying this and receive all records. I only want to return the ones that match bundle.inputData.name
let options = {
url: 'hidden',
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-ACCESS-TOKEN': bundle.authData.access_token
},
params: {
'name': bundle.inputData.name,
'access_token': bundle.authData.access_token
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
return results;
});
Here's a sample response, and I'd like to know how to pull Project 2:
{
"id": 10001,
"name": "Project 1",
"mediaCount": 2,
},
{
"id": 10002,
"name": "Project 2",
"mediaCount": 2,
},
{
"id": 10003,
"name": "Project 3",
"mediaCount": 2,
}
i think you want to get only name so in this case you can use map() function pretty cool
let newResponse=response.map((item,index)=>{ return item.name;})
and it will fine.
and if you want only one record so you can
let newResponse=response.map((item,index)=>{ if(item.name=="project2"){return item}});