import{r as a,p as o,q as d,w as s,z as e,t as h,R as l}from"./vendor.8ed37afc.js";const c={class:"markdown-body"},u=e("div",{class:"two-up"},[e("div",{class:"left"},[e("blockquote",null,[e("p",null,"Most Directus API Endpoint operations can be manipulated with the following parameters. It is important to understand them to get the most out of the platform.")])]),e("div",{class:"right"},[e("p"),e("div",{class:"table-of-contents"},[e("ul",null,[e("li",null,[e("a",{href:"#fields"},"Fields")]),e("li",null,[e("a",{href:"#filter"},"Filter")]),e("li",null,[e("a",{href:"#search"},"Search")]),e("li",null,[e("a",{href:"#sort"},"Sort")]),e("li",null,[e("a",{href:"#limit"},"Limit")]),e("li",null,[e("a",{href:"#offset"},"Offset"),l(" / "),e("a",{href:"#page"},"Page")]),e("li",null,[e("a",{href:"#aggregation-grouping"},"Aggregation & Grouping")]),e("li",null,[e("a",{href:"#deep"},"Deep")]),e("li",null,[e("a",{href:"#aliases"},"Aliases")]),e("li",null,[e("a",{href:"#export"},"Export")])]),e("p"),l(" - [Functions](#functions) "),e("p"),l(" - [Metadata](#metadata) - [Total Count](#total-count) - [Filter Count](#filter-count) ")])])],-1),p=e("hr",null,null,-1),f=e("h2",{id:"fields"},[l("Fields "),e("a",{class:"header-anchor",href:"#fields"},"#")],-1),g=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"Choose the fields that are returned in the current dataset. This parameter supports dot notation to request nested relational fields. You can also use a wildcard (*) to include all fields at a specific depth.")])],-1),m=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples"},"#")]),e("p",null,[l("Get all top-level fields"),e("br"),e("code",null,"*")]),e("p",null,[l("Get all top-level fields and all second-level relational fields"),e("br"),e("code",null,"*.*")]),e("div",{class:"tip hint"},[e("div",{class:"hint-title"},"Performance & Size"),e("p",null,[l("While the fields wildcard is very useful for debugging purposes, we recommend only requesting "),e("em",null,"specific"),l(" fields for production use. By only requesting the fields you really need, you can speed up the request, and reduce the overall output size.")])]),e("p",null,[l("Get all top-level fields and second-level relational fields within images"),e("br"),e("code",null,"*,images.*")]),e("p",null,[l("Get only the first_name and last_name fields"),e("br"),e("code",null,"first_name,last_name")]),e("p",null,[l("Get all top-level and second-level relational fields, and third-level fields within images.thumbnails"),e("br"),e("code",null,"*.*,images.thumbnails.*")]),e("h3",{id:"many-to-any-(union-types)"},[l("Many-To-Any (Union Types) "),e("a",{class:"header-anchor",href:"#many-to-any-(union-types)"},"#")]),e("p",null,[l("Seeing that Many-to-Any (m2a) fields have nested data from multiple collections, it\u2019s not always safe / wanted to fetch the same field from every related collection. In m2a fields, you can use the following syntax to specify what fields to fetch from which related nested collection type:"),e("br"),e("code",null,"?fields=<m2a-field>:<collection-scope>.<field>"),l(".")]),e("p",null,[l("Lets say we have a collection "),e("code",null,"pages"),l(" with a many-to-any field called "),e("code",null,"sections"),l(" that points to "),e("code",null,"headings"),l(", "),e("code",null,"paragraphs"),l(", and "),e("code",null,"videos"),l(". We only want to fetch "),e("code",null,"title"),l(" and "),e("code",null,"level"),l(" from "),e("code",null,"headings"),l(", "),e("code",null,"body"),l(" from "),e("code",null,"paragraphs"),l(" and "),e("code",null,"source"),l(" from "),e("code",null,"videos"),l(". We can achieve that by using:")]),e("pre",null,[e("code",null,`sections.item:headings.title
sections.item:headings.level
sections.item:paragraphs.body
sections.item:videos.source
`)]),e("p",null,"In GraphQL, this can be achieved using Union Types.")]),e("div",{class:"right"},[e("h3",{id:"rest-api"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api"},"#")]),e("pre",null,[e("code",null,`?fields=title,body,featured_image.*

// or

?fields[]=title
&fields[]=body
&fields[]=featured_image.*
`)]),e("h3",{id:"graphql"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql"},"#")]),e("p",null,[e("em",null,"Natively supported in GraphQL")])])],-1),_=e("hr",null,null,-1),v=e("h2",{id:"filter"},[l("Filter "),e("a",{class:"header-anchor",href:"#filter"},"#")],-1),y={class:"two-up"},w={class:"left"},b=l("Used to search items in a collection that matches the filter\u2019s conditions. The filter param follows "),q=l("the Filter Rules spec"),j=l(", which includes additional information on logical operators (AND/OR), nested relational filtering, and dynamic variables."),x=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples-2"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples-2"},"#")]),e("p",null,[l("Retrieve all items where "),e("code",null,"first_name"),l(" equals \u201CRijk\u201D")]),e("pre",null,[e("code",{class:"language-json"},[l(`{
	`),e("span",{class:"hljs-attr"},'"first_name"'),l(`: {
		`),e("span",{class:"hljs-attr"},'"_eq"'),l(": "),e("span",{class:"hljs-string"},'"Rijk"'),l(`
	}
}
`)])]),e("p",null,"Retrieve all items in one of the following categories: \u201Cvegetables\u201D, \u201Cfruit\u201D"),e("pre",null,[e("code",{class:"language-json"},[l(`{
	`),e("span",{class:"hljs-attr"},'"categories"'),l(`: {
		`),e("span",{class:"hljs-attr"},'"_in"'),l(": ["),e("span",{class:"hljs-string"},'"vegetables"'),l(", "),e("span",{class:"hljs-string"},'"fruit"'),l(`]
	}
}
`)])]),e("p",null,"Retrieve all items that are published between two dates"),e("pre",null,[e("code",{class:"language-json"},[l(`{
	`),e("span",{class:"hljs-attr"},'"date_published"'),l(`: {
		`),e("span",{class:"hljs-attr"},'"_between"'),l(": ["),e("span",{class:"hljs-string"},'"2021-01-24"'),l(", "),e("span",{class:"hljs-string"},'"2021-02-23"'),l(`]
	}
}
`)])]),e("p",null,"Retrieve all items where the author\u2019s \u201Cvip\u201D flag is true"),e("pre",null,[e("code",{class:"language-json"},[l(`{
	`),e("span",{class:"hljs-attr"},'"author"'),l(`: {
		`),e("span",{class:"hljs-attr"},'"vip"'),l(`: {
			`),e("span",{class:"hljs-attr"},'"_eq"'),l(": "),e("span",{class:"hljs-literal"},"true"),l(`
		}
	}
}
`)])]),e("div",{class:"tip hint"},[e("div",{class:"hint-title"},"Nested Filters"),e("p",null,[l("The above example will filter the "),e("em",null,"top level"),l(" items based on a condition "),e("em",null,"in"),l(" the related item. If you\u2019re looking to filter the related items themselves, take a look at "),e("a",{href:"#deep"},[l("the "),e("code",null,"deep"),l(" parameter")]),l("!")])])]),e("div",{class:"right"},[e("h3",{id:"rest-api-2"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-2"},"#")]),e("pre",null,[e("code",null,`?filter[first_name][_eq]=Rijk

// or

?filter={ "first_name": { "_eq": "Rijk" }}
`)]),e("h3",{id:"graphql-2"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-2"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	users(filter: { first_name: { _eq: `),e("span",{class:"hljs-string"},'"Rijk"'),l(` } }) {
		id
	}
}
`)])])])],-1),k=e("hr",null,null,-1),G=e("h2",{id:"search"},[l("Search "),e("a",{class:"header-anchor",href:"#search"},"#")],-1),A=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"The search parameter allows you to perform a search on all string and text type fields within a collection. It\u2019s an easy way to search for an item without creating complex field filters \u2013 though it is far less optimized. It only searches the root item\u2019s fields, related item fields are not included.")])],-1),E=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"example"},[l("Example "),e("a",{class:"header-anchor",href:"#example"},"#")]),e("p",null,[l("Find all items that mention Directus"),e("br"),e("code",null,"Directus")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-3"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-3"},"#")]),e("pre",null,[e("code",null,`?search=Directus
`)]),e("h3",{id:"graphql-3"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-3"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles(search: `),e("span",{class:"hljs-string"},'"Directus"'),l(`) {
		id
	}
}
`)])])])],-1),T=e("hr",null,null,-1),R=e("h2",{id:"sort"},[l("Sort "),e("a",{class:"header-anchor",href:"#sort"},"#")],-1),S=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,[l("What field(s) to sort by. Sorting defaults to ascending, but a minus sign ("),e("code",null,"-"),l(") can be used to reverse this to descending order. Fields are prioritized by the order in the parameter.")])])],-1),L=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples-3"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples-3"},"#")]),e("p",null,[l("Sort by creation date descending"),e("br"),e("code",null,"-date_created")]),e("p",null,[l("Sort by a \u201Csort\u201D field, followed by publish date descending"),e("br"),e("code",null,"sort, -publish_date")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-4"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-4"},"#")]),e("pre",null,[e("code",null,`?sort=sort,-date_created

// or

?sort[]=sort
&sort[]=-date_created
`)]),e("h3",{id:"graphql-4"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-4"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles(sort: [`),e("span",{class:"hljs-string"},'"sort"'),l(", "),e("span",{class:"hljs-string"},'"-date_created"'),l(`]) {
		id
	}
}
`)])])])],-1),I=e("hr",null,null,-1),P=e("h2",{id:"limit"},[l("Limit "),e("a",{class:"header-anchor",href:"#limit"},"#")],-1),Q=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,[l("Set the maximum number of items that will be returned. The default limit is set to "),e("code",null,"100"),l(".")])])],-1),D=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples-4"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples-4"},"#")]),e("p",null,[l("Get the first 200 items"),e("br"),e("code",null,"200")]),e("p",null,[l("Get all items"),e("br"),e("code",null,"-1")]),e("div",{class:"warning hint"},[e("div",{class:"hint-title"},"All Items"),e("p",null,"Depending on the size of your collection, fetching unlimited data may result in degraded performance or timeouts, use with caution.")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-5"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-5"},"#")]),e("pre",null,[e("code",null,`?limit=200
`)]),e("h3",{id:"graphql-5"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-5"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles(limit: `),e("span",{class:"hljs-number"},"200"),l(`) {
		id
	}
}
`)])])])],-1),F=e("hr",null,null,-1),N=e("h2",{id:"offset"},[l("Offset "),e("a",{class:"header-anchor",href:"#offset"},"#")],-1),C=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,[l("Skip the first "),e("code",null,"n"),l(" items in the response. Can be used for pagination.")])])],-1),B=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples-5"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples-5"},"#")]),e("p",null,[l("Get items 101\u2014200"),e("br"),e("code",null,"100")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-6"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-6"},"#")]),e("pre",null,[e("code",null,`?offset=100
`)]),e("h3",{id:"graphql-6"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-6"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles(offset: `),e("span",{class:"hljs-number"},"100"),l(`) {
		id
	}
}
`)])])])],-1),M=e("hr",null,null,-1),z=e("h2",{id:"page"},[l("Page "),e("a",{class:"header-anchor",href:"#page"},"#")],-1),W=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,[l("An alternative to "),e("code",null,"offset"),l(". Page is a way to set "),e("code",null,"offset"),l(" under the hood by calculating "),e("code",null,"limit * page"),l(". Page is 1-indexed.")])])],-1),U=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples-6"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples-6"},"#")]),e("p",null,[l("Get items 1-100"),e("br"),e("code",null,"1")]),e("p",null,[l("Get items 101-200"),e("br"),e("code",null,"2")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-7"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-7"},"#")]),e("pre",null,[e("code",null,`?page=2
`)]),e("h3",{id:"graphql-7"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-7"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles(page: `),e("span",{class:"hljs-number"},"2"),l(`) {
		id
	}
}
`)])])])],-1),O=e("hr",null,null,-1),V=e("h2",{id:"aggregation-%26-grouping"},[l("Aggregation & Grouping "),e("a",{class:"header-anchor",href:"#aggregation-%26-grouping"},"#")],-1),J=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"Aggregate functions allow you to perform calculations on a set of values, returning a single result.")])],-1),Y=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"The following aggregation functions are available in Directus:"),e("table",null,[e("thead",null,[e("tr",null,[e("th",null,"Name"),e("th",null,"Description")])]),e("tbody",null,[e("tr",null,[e("td",null,[e("code",null,"count")]),e("td",null,"Counts how many items there are")]),e("tr",null,[e("td",null,[e("code",null,"countDistinct")]),e("td",null,"Counts how many unique items there are")]),e("tr",null,[e("td",null,[e("code",null,"sum")]),e("td",null,"Adds together the values in the given field")]),e("tr",null,[e("td",null,[e("code",null,"sumDistinct")]),e("td",null,"Adds together the unique values in the given field")]),e("tr",null,[e("td",null,[e("code",null,"avg")]),e("td",null,"Get the average value of the given field")]),e("tr",null,[e("td",null,[e("code",null,"avgDistinct")]),e("td",null,"Get the average value of the unique values in the given field")]),e("tr",null,[e("td",null,[e("code",null,"min")]),e("td",null,"Return the lowest value in the field")]),e("tr",null,[e("td",null,[e("code",null,"max")]),e("td",null,"Return the highest value in the field")])])]),e("h3",{id:"grouping"},[l("Grouping "),e("a",{class:"header-anchor",href:"#grouping"},"#")]),e("p",null,[l("By default, the above aggregation functions run on the whole dataset. To allow for more flexible reporting, you can combine the above aggregation with grouping. Grouping allows for running the aggregation functions based on a shared value. This allows for things like "),e("em",null,"\u201CAverage rating per month\u201D"),l(" or "),e("em",null,"\u201CTotal sales of items in the jeans category\u201D"),l(".")]),e("p",null,[l("The "),e("code",null,"groupBy"),l(" query allows for grouping on multiple fields simultaneously. Combined with the "),e("a",{href:"#functions"},"Functions"),l(", this allows for aggregate reporting per year-month-date.")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-8"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-8"},"#")]),e("pre",null,[e("code",null,`?aggregate[avg]=cost
&groupBy[]=author
&groupBy[]=year(publish_date)
`)]),e("h3",{id:"graphql-8"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-8"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles_aggregated(groupBy: [`),e("span",{class:"hljs-string"},'"author"'),l(", "),e("span",{class:"hljs-string"},'"year(publish_date)"'),l(`]) {
		group
		sum {
			revenue
		}
	}
}
`)])])])],-1),H=e("hr",null,null,-1),K=e("h2",{id:"deep"},[l("Deep "),e("a",{class:"header-anchor",href:"#deep"},"#")],-1),X=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"Deep allows you to set any of the other query parameters on a nested relational dataset.")])],-1),Z=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"examples-7"},[l("Examples "),e("a",{class:"header-anchor",href:"#examples-7"},"#")]),e("p",null,"Limit the nested related articles to 3"),e("pre",null,[e("code",{class:"language-json"},[l(`{
	`),e("span",{class:"hljs-attr"},'"related_articles"'),l(`: {
		`),e("span",{class:"hljs-attr"},'"_limit"'),l(": "),e("span",{class:"hljs-number"},"3"),l(`
	}
}
`)])]),e("p",null,"Only get 3 related articles, with only the top rated comment nested"),e("pre",null,[e("code",{class:"language-json"},[l(`{
	`),e("span",{class:"hljs-attr"},'"related_articles"'),l(`: {
		`),e("span",{class:"hljs-attr"},'"_limit"'),l(": "),e("span",{class:"hljs-number"},"3"),l(`,
		`),e("span",{class:"hljs-attr"},'"comments"'),l(`: {
			`),e("span",{class:"hljs-attr"},'"_sort"'),l(": "),e("span",{class:"hljs-string"},'"rating"'),l(`,
			`),e("span",{class:"hljs-attr"},'"_limit"'),l(": "),e("span",{class:"hljs-number"},"1"),l(`
		}
	}
}
`)])])]),e("div",{class:"right"},[e("h3",{id:"rest-api-9"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-9"},"#")]),e("pre",null,[e("code",null,`?deep[translations][_filter][languages_code][_eq]=en-US

// or

?deep={ "translations": { "_filter": { "languages_code": { "_eq": "en-US" }}}}
`)]),e("h3",{id:"graphql-9"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-9"},"#")]),e("p",null,[e("em",null,"Natively supported in GraphQL:")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	members {
		favorite_games(filter: { name: { _eq: `),e("span",{class:"hljs-string"},'"Mariokart 8"'),l(` } }) {
			id
			featured_image {
				filename_disk
			}
		}
	}
}
`)])])])],-1),$=e("hr",null,null,-1),ee=e("h2",{id:"aliases"},[l("Aliases "),e("a",{class:"header-anchor",href:"#aliases"},"#")],-1),le=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"Aliases allow you rename fields on the fly, and request the same nested data set multiple times using different filters.")])],-1),te=e("div",{class:"two-up"},[e("div",{class:"left"},[e("div",{class:"warning hint"},[e("div",{class:"hint-title"},"Nested fields"),e("p",null,[l("It is only possible to alias same level fields."),e("br"),l(" Alias for nested fields, f.e. "),e("code",null,"field.nested"),l(", will not work.")])])]),e("div",{class:"right"},[e("h3",{id:"rest-api-10"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-10"},"#")]),e("pre",null,[e("code",null,`?alias[all_translations]=translations
&alias[dutch_translations]=translations
&deep[dutch_translations][_filter][code][_eq]=nl-NL
`)]),e("h3",{id:"graphql-10"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-10"},"#")]),e("p",null,[e("em",null,"Natively supported in GraphQL:")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles {
		dutch_translations: translations(filter: { code: { _eq: `),e("span",{class:"hljs-string"},'"nl-NL"'),l(` } }) {
			id
		}

		all_translations: translations {
			id
		}
	}
}
`)])])])],-1),ae=e("hr",null,null,-1),se=e("h2",{id:"export"},[l("Export "),e("a",{class:"header-anchor",href:"#export"},"#")],-1),ne=e("p",null,"Save the current API response to a file.",-1),ie=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,[l("Saves the API response to a file. Accepts one of "),e("code",null,"json"),l(", "),e("code",null,"csv"),l(", "),e("code",null,"xml"),l(".")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-11"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-11"},"#")]),e("pre",null,[e("code",null,`?export=json
?export=csv
?export=xml
`)]),e("h3",{id:"graphql-11"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-11"},"#")]),e("p",null,"n/a")])],-1),re=e("hr",null,null,-1),oe=e("h2",{id:"functions"},[l("Functions "),e("a",{class:"header-anchor",href:"#functions"},"#")],-1),de=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"Functions allow for \u201Clive\u201D modification of values stored in a field. Functions can be used in any query parameter you\u2019d normally supply a field key, including fields, aggregation, and filter.")])],-1),he=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,"Functions can be used by wrapping the field key in a JavaScript like syntax, for example:"),e("p",null,[e("code",null,"timestamp"),l(" -> "),e("code",null,"year(timestamp)")]),e("h3",{id:"datetime-filters"},[l("DateTime Filters "),e("a",{class:"header-anchor",href:"#datetime-filters"},"#")]),e("table",null,[e("thead",null,[e("tr",null,[e("th",null,"Filter"),e("th",null,"Description")])]),e("tbody",null,[e("tr",null,[e("td",null,[e("code",null,"year")]),e("td",null,"Extract the year from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"month")]),e("td",null,"Extract the month from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"week")]),e("td",null,"Extract the week from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"day")]),e("td",null,"Extract the day from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"weekday")]),e("td",null,"Extract the weekday from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"hour")]),e("td",null,"Extract the hour from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"minute")]),e("td",null,"Extract the minute from a datetime/date/timestamp field")]),e("tr",null,[e("td",null,[e("code",null,"second")]),e("td",null,"Extract the second from a datetime/date/timestamp field")])])]),e("div",{class:"warning hint"},[e("div",{class:"hint-title"},"GraphQL"),e("p",null,[l("Names aren\u2019t allowed to include any special characters in GraphQL, preventing the "),e("code",null,"()"),l(" syntax from being used.")]),e("p",null,[l("As an alternative, the above functions can be used by appending "),e("code",null,"_func"),l(" at the end of the field name, and using the function name as the nested field (see the example on the right).")])])]),e("div",{class:"right"},[e("h3",{id:"rest-api-12"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-12"},"#")]),e("pre",null,[e("code",null,`?fields=id,title,weekday(date_published)
&filter[year(date_published)][_eq]=2021
`)]),e("h3",{id:"graphql-12"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-12"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),l(` {
	articles(filter: { date_published_func: { year: { _eq: `),e("span",{class:"hljs-number"},"2021"),l(` } } }) {
		id
		title
		date_published_func {
			weekday
		}
	}
}
`)])])])],-1),ce=e("hr",null,null,-1),ue=e("h2",{id:"metadata"},[l("Metadata "),e("a",{class:"header-anchor",href:"#metadata"},"#")],-1),pe=e("div",{class:"two-up"},[e("div",{class:"left"},[e("p",null,[l("Metadata allows you to retrieve some additional information about the items in the collection you\u2019re fetching. "),e("code",null,"*"),l(" can be used as a wildcard to retrieve all metadata.")])])],-1),fe=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"total-count"},[l("Total Count "),e("a",{class:"header-anchor",href:"#total-count"},"#")]),e("p",null,"Returns the total item count of the collection you\u2019re querying."),e("h3",{id:"filter-count"},[l("Filter Count "),e("a",{class:"header-anchor",href:"#filter-count"},"#")]),e("p",null,"Returns the item count of the collection you\u2019re querying, taking the current filter/search parameters into account.")]),e("div",{class:"right"},[e("h3",{id:"rest-api-13"},[l("REST API "),e("a",{class:"header-anchor",href:"#rest-api-13"},"#")]),e("pre",null,[e("code",null,`?meta=total_count

?meta=filter_count

?meta=*
`)]),e("h3",{id:"graphql-13"},[l("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-13"},"#")]),e("p",null,"n/a")])],-1),ye={setup(ge,{expose:n}){const t={title:"Global Query Parameters",modularExtension:!1,pageClass:"page-reference"};return n({frontmatter:t}),(me,_e)=>{const i=a("router-link"),r=a("DocsWrapper");return o(),d(r,{frontmatter:t},{default:s(()=>[e("div",c,[u,p,f,g,m,_,v,e("div",y,[e("div",w,[e("p",null,[b,h(i,{to:"/docs/configuration/filter-rules"},{default:s(()=>[q]),_:1}),j])])]),x,k,G,A,E,T,R,S,L,I,P,Q,D,F,N,C,B,M,z,W,U,O,V,J,Y,H,K,X,Z,$,ee,le,te,ae,se,ne,ie,re,oe,de,he,ce,ue,pe,fe])]),_:1})}}};export{ye as default};
