Skip to content

Is it possible to use where with the Content Query API (using Endpoints)? #1420

Answered by yungParrot
nobkd asked this question in Q&A
Discussion options

You must be logged in to vote

The docs don't specify how it should be done... After looking at the source code of the query module, I've figured out that you could send JSON parameters to the API 👇

const query = {
  where: { _path: { $contains: "a" } }
};

const response = axios.get(`/api/_content/query?_params=${JSON.stringify(query)}`);

This should return all articles containing "a" in their _path.

👉 https://content.nuxtjs.org/api/composables/query-content


🤠

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nobkd
Comment options

Answer selected by nobkd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants