Best answer

Trying to get the results after the JSON success.

  • 2 April 2021
  • 1 reply
  • 122 views

Userlevel 1

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":[
{
"campaignid":63651,
"rundate":1611680490,
"campaignname":"Activation Flow",
"medium":"channel"
}
]
}
}

 

icon

Best answer by ikbelkirasan 2 April 2021, 23:29

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +12

@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];
});