Skip to main content
Best answer

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


I’ve looked at the four responses on this issue but haven’t been able to get them to work. I’ve reviewed this GitHub entry and have a sense for what it wants me to do, but not how I should implement it.

My polling trigger API is trying to substitite my “_id” for the expected “id” element. Much like the other four posts on this problem have suggested.

const options = {
  url: 'https://app.hiro.fm/api/products',
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${bundle.authData.token}`
  },
  params: {

  }
}

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

/* Also tried this syntax but get the same error */
/*
return z.request(options).then((response) => {
    response.throwForStatus();
    const result = z.JSON.parse(response.content);
    return [{
      ...result,
      id: result._id,
    },];
});
*/

My response array looks like this. See the _id I’m aiming for?

[
    {
        "artworkUrl": "https://hiro-fm.s3.amazonaws.com/static/artwork/default-art.jpg",
        "releaseMode": 0,
        "episodes": [
            "5eee5aae0dc1ac00198589a5"
        ],
        "_id": "5eee4d6b0dc1ac00198589a1",
        "name": "TEST",
        "description": "TEST PRODUCT",
        "instructorName": "",
        "copyright": "",
        "studentKeys": [],
        "updatedAt": "2020-06-20T18:51:26.066Z",
        "createdAt": "2020-06-20T17:54:51.892Z",
        "__v": 1
    }
]

And yet I still get the error

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

 

At this point I’m feeling deeply humbled and rather stupid for having spent so long trying to get this to work. Can ayone like @ForYourIT  or @ikbelkirasan or even @Danvers  show me what I’m doing wrong?

Thanks

-Colin

Best answer by whitecaBest answer by whiteca

Oops. I think I’ve solved this. Looks like a rookie error on my part. Basically mis-handled the response array.

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

  • Author
  • Beginner
  • 3 replies
  • Answer
  • June 23, 2020

Oops. I think I’ve solved this. Looks like a rookie error on my part. Basically mis-handled the response array.


Liz_Roberts
Forum|alt.badge.img+8
  • Zapier Staff
  • 1366 replies
  • June 24, 2020

Thanks for letting us know, @whiteca !