Skip to main content
Best answer

Got a non-object result in the array

  • December 26, 2021
  • 8 replies
  • 826 views

Hi, I’m trying to integrate Facebook Lead to my CRM via the Zapier platform.

unfortunately, in the trigger’s step, I got an error about the return type of my request, so I turn to code mode and turn the return type to be an array.

Now, I got an other error: “Got a non-object result in the array” and I really don't know what I’m not doing good, can you help me please ? 

 

 

Invalid API Response:

- Got a non-object result in the array, expected only objects ([{"id":XXXXXXXXX,"total_leads":XXXX,"assigned_to":nu) - Got a result missing the "id" property ([{"id":XXXXXXXX,"total_leads":XXXX,"assigned_to":null,"domain_uuid":"XXXXXXXXXXXXXXXXXXXXXXXXXXXX","created_by":null,"created_at":1640512122,"updated_at":1640512122,"module":{"id":XXXX,"tags":[],"fields":[{"id":XXXXX,"domain_uuid":"XXXXXXXXXXX) What happened (You are seeing this because you are an admin): Executing triggers.get_data.operation.perform with bundle Invalid API Response: - Got a non-object result in the array, expected only objects ([{"id":XXXXXXXXX,"total_leads":XXXX,"assigned_to":nu) - Got a result missing the "id" property ([{"id":XXXXXXXXX,"total_leads":XXXX,"assigned_to":null,"domain_uuid":"XXXXXXXXXXXXXXXXXXXXXXXXX","created_by":null,"created_at":1640512122,"updated_at":1640512122,"module":{"id":XXXX,"tags":[],"fields":[{"id":XXXXX,"domain_uuid":"XXXXXXXX)

Best answer by mzsadiek

Hi @Israel Mimouni! I just responded to your other topic because I hadn’t seen this one. Take a look at this thread, as it looks similiar to your problem: 

 

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

8 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • December 28, 2021

Hi @Israel Mimouni 

Can you please post screenshots with how your Zap steps are configured, thanks.


  • Author
  • Beginner
  • December 29, 2021

Hi, yes, of course: 

Authentication 

Triggers

Actions

Do you need something else in order to help me find out what wrong in my setup ? 

Thank you very much !


  • Author
  • Beginner
  • December 29, 2021

 


mzsadiek
Forum|alt.badge.img+5
  • Zapier Solution Partner
  • Answer
  • December 29, 2021

Hi @Israel Mimouni! I just responded to your other topic because I hadn’t seen this one. Take a look at this thread, as it looks similiar to your problem: 

 


  • Author
  • Beginner
  • December 29, 2021

HI @mzsadiek , I just tried it and got an other error message : “Got a result missing the "id" property ”.

Right now, I try to follow the responses of someone how ask about the same issue, if you have any idea that can help me, I will very thanks full! 


  • Author
  • Beginner
  • December 29, 2021

This is my current code :

const options = {
  url: 'https://api.kavkom.com/api/crm/v1/lead/list',
  method: 'GET',
  headers: {
    'X-API-TOKEN': bundle.authData["X-API-TOKEN"],
    'Accept': ["application/json"],
    'Content-Type': ["application/json"]
  },
  params: {
    'domain_uuid': bundle.authData["domain_uuid"],
    'limit': '1'
  }
};

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


GetUWired
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • December 30, 2021

Hi @Israel Mimouni 

Assuming your ‘results’ variable is like the attached
const results = response.json;

return [results.data]

 


Danvers
Forum|alt.badge.img+12
  • Zapier Staff
  • December 30, 2021

Hi @Israel Mimouni!

Zapier looks for a field explicitly named id to find a unique identifier for the object, so that we can avoid processing the same object more than once.. There’s more information about that and an example in the answer to this post: