-
Notifications
You must be signed in to change notification settings - Fork 35
Returning Multiple References #85
Comments
Hey @chuise, The second query is good, only thing I would change is Try experimenting with increasing the levels of includes until you reach the amount of resolution you need. Maximum is Hope this helps |
Hey @dlitvakb. Thanks for the response. I've played around with various
I still end up with something like:
It's clearly pulling in some of the
Is Thanks. |
Hey @chuise & @timcreatewell, In both cases the Make sure that if you are not using the Preview API, all content is published. You can also debug the query yourself in the console by doing: require 'contentful'
client = Contentful::Client.new(
space: 'your_space_id',
access_token: 'your_access_token',
dynamic_entries: :auto
)
client.entries(include: 2) Make sure that returns what you expect, if not, please ping me back again. Also, please take a look at the examples repository, which is making use of nested relationships here: https://github.com/contentful/contentful_middleman_examples/tree/master/examples/multiple_content_types Cheers |
Hey @dlitvakb, Running the code you supplied in the console yields:
It looks like it's pulling down the I'm attempting to access the category by:
Is the issue with what's being returned or how I'm attempting to access this? Also, we're not using the Preview API. Thanks again for the assist on this. |
This is one of the oddest things I've encountered... Our |
Hehe! 😅 Glad to be of Help! 👍 No idea how that could be related, if you see this behaviour repeating, can you open a support ticket? This might be something API related that we haven't found. Cheers |
UPDATE @dlitvakb you posted your last comment as I was typing this so I apologize. I ran a little test to see if the image was the culprit and here is what happened.
All linked content disappears from the Integration entry:
Just for the hell of it I added back the image field to the
Very odd behavior. Luckily at least one of our content types contains an image 👍 . I can open a ticket on the API. |
Hey @chuise, Thanks for the detailed explanation |
Pardon my ignorance on this... I'm having a hard time determining how to pull back multiple content types that reference other content types. For example... We have integration that belong to an integration_category (ex. Salesforce belongs to CRM category). It seems that if I use the following cda_query all other content types are ignored:
For instance, if I have 10 integration content types and 5 integration_category content types only the integration content type records are returned and placed in the data directory.
That's the output I would expect. It's perfect, but I only get one of the content types back. Using the following I manage to get all of the content types, but it doesn't seem that I get any of the reference data from content types that have relationships to each other:
My integration content type ends up looking like this:
Note that the "name" field is no longer available.
From reading the documentation is seems like
include: 1
should add the appropriate information to related objects, but I could be misinterpreting that. I would expect that the resulting YAML for all of my content types that have references to other content types results in something similar to the first example. What am I doing wrong here?The text was updated successfully, but these errors were encountered: