I used an empty
fetch parameter in my code to get a list of documents. I was interested only in meta data. I'm pretty sure it worked that time back in October 2018.
Now I need to implement a sitemap generator and I noticed that
fetch doesn't work for me. With empty
fetch value I get entire documents. When I limit my search to a particular document type,
showroom for instance, and I add
fetch=showroom.robots as query parameter, I get entire documents again.
Am I doing anything wrong? Is the
fetch parameter still working?
Hey @marek.idec Welcome to the forum!!
Can you show me an example of the query and the response to have a visual idea of this?
And yes, the fetch predicate should work correctly
Actually you should be able to see it yourself
If ref is expired find a new master ref and use it, pls. In
results section of the response I can see entire documents.
Hey, I'm trying to see the link that you share with me, but the ref is not valid.
I think it'll be easier if you show me the query itself, could you send me a screenshot of your API browser with the query or a gist with it?
And also, in which documents are you trying to look for the
showroom.robots field? You have many other types like advisory, campaign, global nav.. etc. I want to know this so I can do a test on my side
Hi, Paulina. Apparently we are misunderstanding each other. Forget my problem and answer my questions, please.
fetchparameter is used to retrieve only specified fields instead of an entire document. What is expected behavior if the value is empty
fetch=? Does empty
fetchparameter mean give me entire documents? I'm pretty sure that 2 years ago only meta data like
typeand so on where returned.
I'm interested in listing all published documents and I need only 3 fields from them:
lang. What value should I use in
fetchto achieve that?
Hey, sorry if there were a mixup.
You have to specifically indicate the fields that you need from the linked document, otherwise it won't return anything. I'm not aware of what was the past behaviour of the fetch predicate, but yes, as for today, you ave to specify the needed fields.
Any query you make will retrieve only publishes documents, unless you're querying a release using the release ref, but if that is not the case, then published documents will always be retrieved.
Maybe in this case a Fulltext search would be more appropriate, that way you can query by the content of a given field, would that be more useful?
I'm sorry. English is not my primary language and this must be a reason you misunderstood my questions again.
I know that only published documents will be retrieved. My question is: what value should I use in
fetch parameter to get only three fields from documents -
Yes you can, it will be included in the response of the fetched query. I'm going to show you an example. I have a Content rel. field in a Post type document. And i'm linking a document of the type Article now I'm just retrieving it's title:
And heres the response:
As you can see, the uid, type and language are included there!
I hope this is helpful and sorry for all the back and forth
When to my question "What value should I use in fetch parameter?" the answer is "Yes you can" I'm giving up.
I simply don't know how to put my questions into words. I don't expect any sensible response from this forum.
Paulina, enjoy your life and be happy.