Return modelName with content API response

There are many cases where you might want to know the model name for a given Builder content item JSON. For example, if you have a function that takes some kind of Builder content item as input, then formats links one way or another based on whether it’s a page or a blog-post. You’re not always handling content API response data right after making an API call, so you don’t always know which model you’re currently working with.

It would be nice for that reason if the content API responses included the model name.

Content API responses currently include the model ID, but not the model name. Problems with this:

  • You can use the model id to look up the model name, but it involves an additional network request to the admin API.
  • To boot, the admin API is GraphQL, which arguably is harder to work with for such a simple use case.
  • Working with the model name is much more convenient and the norm anyway when using the various SDKs.

1 Like

hey @ersin thanks for submitting to the idea board!

While we prioritize that against our other work, if you ever have a specific use case that you are currently stuck on for this let me know and we can try to find a simple solution in the meantime…usually there is some sort of work around to be had!

1 Like

All good, I ended up going with a hack that compares the data.url fields to determine the model since in my case the two models in question have different URL path structures.

Thanks @TimG!

1 Like