Question

Invalid API Response: - Got a result missing the "id" property

  • 1 March 2023
  • 3 replies
  • 674 views

Hello,

 

I am getting this error when making API call. My error code:

 

Invalid API Response: - Results must be an array, got: object, ({"Meta":{"href":"democrm.logo.com.tr:88/LogoCrmRes) - Got a result missing the "id" property ({"href":"democrm.logo.com.tr:88/LogoCrmRest/api","mediaType":"application/json; charset=UTF-8","fullPath":"/LogoCrmRest/api/v1.0/tickets","apiVersion":"1","timeStamp":"2023-03-01T11:55:09.09"}) What happened (You are seeing this because you are an admin): Executing triggers.ticket_Id.operation.perform with bundle Invalid API Response: - Results must be an array, got: object, ({"Meta":{"href":"democrm.logo.com.tr:88/LogoCrmRes) - Got a result missing the "id" property ({"href":"democrm.logo.com.tr:88/LogoCrmRest/api","mediaType":"application/json; charset=UTF-8","fullPath":"/LogoCrmRest/api/v1.0/tickets","apiVersion":"1","timeStamp":"2023-03-01T11:55:09.09"})

 

Here is the code: 

 

const options = {
  url: 'http://democrm.logo.com.tr/LogoCrmRest/api/v1.0/tickets?SessionId=116ff783-01c7-431c-bd69-fbd7a4cfa47c&withCount=true&offset=0&limit=3',
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'X-USERNAME': bundle.authData.username
  },
  params: {
    'username': bundle.authData.username
  }
}

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

 

how do i solve this problem? Can you please help?

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

3 replies

Userlevel 4
Badge +9

Hey @alperentan 👋

Triggers in Zapier expect to receive a JSON formatted array with the results in reverse chronological order: https://platform.zapier.com/docs/faq#what-response-type-does-zapier-expect 

From that error message, it seems like the results returned are not an array. I’d suggest trying to update that line to return [results]

Yes, that error has been resolved, but now it gives this error:

 

Invalid API Response: - Got a result missing the "id" property ({"Meta":{"href":"democrm.logo.com.tr:88/LogoCrmRest/api","mediaType":"application/json; charset=UTF-8","fullPath":"/LogoCrmRest/api/v1.0/tickets","apiVersion":"1","timeStamp":"2023-03-08T13:22:39.39"},"Result":0,"Message":"(-308) Doğrulama hatası: \") What happened (You are seeing this because you are an admin): Executing triggers.TicketDescription.operation.perform with bundle Invalid API Response: - Got a result missing the "id" property ({"Meta":{"href":"democrm.logo.com.tr:88/LogoCrmRest/api","mediaType":"application/json; charset=UTF-8","fullPath":"/LogoCrmRest/api/v1.0/tickets","apiVersion":"1","timeStamp":"2023-03-08T13:22:39.39"},"Result":0,"Message":"(-308) Doğrulama hatası: \")

 

Here is the code: 

 

const options = {
  url: 'http://democrm.logo.com.tr/LogoCrmRest/api/v1.0/tickets?SessionId=116ff783-01c7-431c-bd69-fbd7a4cfa47c&withCount=true&offset=0&limit=3',
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'X-USERNAME': bundle.authData.username
  },
  params: {
    'username': bundle.authData.username
  }
}

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

 

how do i solve this problem? Can you please help?
Userlevel 4
Badge +9

Hey @alperentan 👋

Here are some similar posts with solutions for that error:

 

 

If the response does not have an id field, you would want to add code to assign it: https://platform.zapier.com/docs/dedupe#custom-or-multiple-id-fields 

If you’re still having trouble after reviewing those, please post what is included from the API call to that endpoint.