Skip to main content

Here is my code that is returning the error. I want to return everything within “Data”

const options = {
url: `${bundle.authData.server}/org/${bundle.authData.orgId}/profile/${bundle.inputData.profile_id}`,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Token ${bundle.authData.token}`
},
params: {
'profile_id': bundle.inputData.profile_id
}
}

return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;

// You can do any parsing you need for results here before returning them

return results;
});

The error I get is:

 

 

Invalid API Response: - Results must be an array, got: object, ({"successMsg":"Get profile information with campai) What happened (You are seeing this because you are an admin): Executing searches.get_candidate.operation.perform with bundle Invalid API Response: - Results must be an array, got: object, ({"successMsg":"Get profile information with campai)

 

 

{
"successMsg":"Get profile information with campaigns info",
"status":"success",
"statusCode":200,
"data":{
"profile_info":{
"last-active-date":"1617391026",
"opt-in-date":"1617391002",
"opt-in":"Yes",
"name":"Paul Collins",
"first-name-auto":"Paul",
"last-name-auto":"Collins",
"email":"paul@roborecruiter.ai",
"mobile":"14155556666",
"availability":"1 month",
"availability-date":"1619983026",
"availability-value":"1"
},
"campaign_info":n
{
"campaignid":63651,
"rundate":1611680490,
"campaignname":"Activation Flow",
"medium":"channel"
}
]
}
}

 

@cozza13 - Try this:

const options = {
url: `${bundle.authData.server}/org/${bundle.authData.orgId}/profile/${bundle.inputData.profile_id}`,
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Token ${bundle.authData.token}`,
},
params: {
profile_id: bundle.inputData.profile_id,
},
};

return z.request(options).then((response) => {
response.throwForStatus();
const profile = Object.assign({}, response.json.data, {
id: bundle.inputData.profile_id,
});
return profile];
});