Question

Invalid API Reponse: Got a result missing the "id" property

  • 12 May 2020
  • 3 replies
  • 2597 views

Hi guys, I’m trying to connect a custom Zapier integration and I came across the “Missing ID Property” error.

I’m trying to use the “campaignID” as the “id” to identify the objects for Zapier.

 

This is the output of the json.

{
"links": [
{
"href": "http://api.sitescout.com/advertisers/81054/campaigns/stats",
"rel": "self"
},
{
"href": "http://api.sitescout.com/advertisers/81054/campaigns/stats?page=2",
"rel": "next"
}
],
"totalCount": 3261,
"results": [
{
"entity": {
"links": [],
"campaignId": 1318933,
"name": "CCBC Click Retargeting April'20",
"campaignGroupId": 269197,
"campaignGroupName": "CCBC April'20 I know do you/Dyer",
"status": "online",
"defaultBid": 4,
"notes": "",
"budget": {
"links": [],
"amount": 60,
"type": "daily",
"evenDeliveryEnabled": true,
"schedule": {
"flightDates": {
"from": "20200401",
"to": "20200430"
}
}
},
"created": "20200401 00:00:00",
"reviewStatus": "eligible",
"portalApprovalStatus": "eligible",
"campaignType": "mobile_retargeting",
"frequencyCapping": {
"impressions": 6,
"periodInHours": 12,
"type": "campaign"
},
"enabledRON": false,
"enabledROP": false,
"enableCrossDevice": false,
"isRelativeDayParting": false,
"kpiValue": "1",
"kpiType": "CTR",
"pacingSetting": "CAMPAIGN",
"excludeAnonymousDomains": false,
"enablePixalateViewability": false,
"impressionPacing": {
"evenDeliveryEnabledForImpressions": false
}
},
"stats": {
"impressionsBid": 0,
"impressionsWon": 0,
"dataCost": 0,
"auctionsSpend": 0,
"totalSpend": 0,
"nonBillableSpend": 0,
"clicks": 0,
"offerClicks": 0,
"clickThroughConversions": 0,
"ctcRevenue": 0,
"viewThroughConversions": 0,
"vtcRevenue": 0,
"totalConversions": 0,
"revenue": 0,
"videoStarted": 0,
"videoFirstQuartileReached": 0,
"videoMidpointReached": 0,
"videoThirdQuartileReached": 0,
"videoCompleted": 0,
"videoSkipped": 0,
"eligibleImpressions": 0,
"viewableImpressions": 0,
"measuredImpressions": 0,
"viewabilitySpend": 0,
"companionImpressions": 0,
"companionClicks": 0,
"companionConversions": 0,
"companionOfferRevenue": 0,
"winRate": 0,
"clickThroughRate": 0,
"offerClickThroughRate": 0,
"conversionRate": 0,
"clickCVR": 0,
"viewCVR": 0,
"videoCompletionRate": 0,
"videoSkippedRate": 0,
"returnOnAdSpend": 0,
"profitPerClick": 0,
"dataEffectiveCPM": 0,
"costPerClick": 0,
"mediaEffectiveCPM": 0,
"costPerAcquisition": 0,
"revenuePerMille": 0,
"clickEffectiveCPA": 0,
"viewEffectiveCPA": 0,
"clickRPM": 0,
"measuredRate": 0,
"viewableRate": 0,
"viewableCPM": 0,
"totalCVRM": 0,
"totalEffectiveCPM": 0,
"totalEffectiveCPCV": 0,
"conversions": 0,
"viewthruConversions": 0,
"clickthruRate": 0,
"offerClickthruRate": 0,
"dataSpend": 0,
"auctionsWon": 0,
"effectiveCPM": 0
},

 

When I use this code:

const options = {
url: `https://api.sitescout.com/advertisers/${bundle.authData.ad_id}/campaigns/stats`,
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${bundle.authData.access_token}`,
'content-type': 'application/json'
},
params: {

}
}

return z.request(options).then((response) => {
response.throwForStatus();
const result = z.JSON.parse(response.content);
result.id = result.ID;
return [result];
});

 

This is what comes up:

Invalid API Response: - Got a result missing the "id" property ({"links":[{"href":"http://api.sitescout.com/advertisers/81054/campaigns/stats","rel":"self"},{"href":"http://api.sitescout.com/advertisers/81054/campaigns/stats?page=2","rel":"next"}],"totalCount":3261,"results":[{"entity":{"links":[],"campaignId":13) What happened (You are seeing this because you are an admin): Executing triggers.campaigns.operation.perform with bundle Invalid API Response: - Got a result missing the "id" property ({"links":[{"href":"http://api.sitescout.com/advertisers/81054/campaigns/stats","rel":"self"},{"href":"http://api.sitescout.com/advertisers/81054/campaigns/stats?page=2","rel":"next"}],"totalCount":3261,"results":[{"entity":{"links":[],"campaignId":13) Console logs:

 

 

 

And when I use this code:

const options = {
url: `https://api.sitescout.com/advertisers/${bundle.authData.ad_id}/campaigns/stats`,
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${bundle.authData.access_token}`,
'content-type': 'application/json'
},
params: {

}
}

return z.request(options).then((response) => {
response.throwForStatus();
const result = z.JSON.parse(response.content);
result.entity.campaignId = result.id;
return [result];
});

This is what comes up:

Cannot set property 'campaignId' of undefined What happened (You are seeing this because you are an admin): Starting GET request to https://api.sitescout.com/advertisers/81054/campaigns/stats Received 200 code from https://api.sitescout.com/advertisers/81054/campaigns/stats after 603ms Received content "{"links":[{"href":"http://api.sitescout.com/advertisers/81054/campaigns/stats","rel":"self"},{"href"" Cannot set property 'campaignId' of undefined Console logs:

 

Does anyone have a possible solution? Thanks so much in advance!


This topic has been closed for comments

3 replies

Userlevel 7
Badge +11

Hi @JSA - I think it would be best if the Support Team takes a look at this one, so I’m going to escalate it to them. Someone will be in touch via email as soon as possible, thanks!

Userlevel 7
Badge +10

Hi @JSA!

It looks like you’ve contacted our Support team and they sent you a response with some instructions :) Please respond to that message, if you have any other questions about this issue.

Userlevel 7
Badge +10

For anyone who finds this and is looking for a solution, here’s what the response was, from Support:

It looks like your Trigger may have previously been set up to poll the endpoint: https://api.sitescout.com/advertisers/81054/campaigns/stats

However it's now set to make a GET request to a .csv and you're getting an error parsing that response. We don't have a way for you to pass CSV data directly to a trigger. You would instead have to pass the actual CSV file, or a link to it, and then use Formatter by Zapier to format the CSV data.

Alternatively, if you could switch it back to the original endpoint, then adjust your code to use a map() method where you replace campaignID with id for each element in the calling array, that should help return the results that we're expecting. Check out the example code shown here: https://github.com/zapier/zapier-platform/tree/master/packages/cli#why-are-my-triggers-complaining-if-i-dont-provide-an-explicit-id-field

I hope that will help point you in the right direction! Let me know if I can help with anything else.