Wishlist supports accessing Item and List objects via GraphQL. Be sure to read about Craft's GraphQL support (opens new window).
{
wishlists (userId: 1) {
title
items {
title
}
}
}
{
"data": {
"wishlists": [
{
"title": "Wishlist",
"items": [
{
"title": "Some Entry"
}
]
},
{
"title": "Favourites",
"items": []
}
]
}
}
wishlists
query#This query is used to query for lists.
Argument | Type | Description |
---|---|---|
id | [QueryArgument] | Narrows the query results based on the elements’ IDs. |
uid | [String] | Narrows the query results based on the elements’ UIDs. |
status | [String] | Narrows the query results based on the elements’ statuses. |
archived | Boolean | Narrows the query results to only elements that have been archived. |
trashed | Boolean | Narrows the query results to only elements that have been soft-deleted. |
site | [String] | Determines which site(s) the elements should be queried in. Defaults to the current (requested) site. |
siteId | String | Determines which site(s) the elements should be queried in. Defaults to the current (requested) site. |
unique | Boolean | Determines whether only elements with unique IDs should be returned by the query. |
enabledForSite | Boolean | Narrows the query results based on whether the elements are enabled in the site they’re being queried in, per the site argument. |
title | [String] | Narrows the query results based on the elements’ titles. |
slug | [String] | Narrows the query results based on the elements’ slugs. |
uri | [String] | Narrows the query results based on the elements’ URIs. |
search | String | Narrows the query results to only elements that match a search query. |
relatedTo | [Int] | Narrows the query results to elements that relate to any of the provided element IDs. This argument is ignored, if relatedToAll is also used. |
relatedToAll | [Int] | Narrows the query results to elements that relate to all the provided element IDs. Using this argument will cause relatedTo argument to be ignored. |
ref | [String] | Narrows the query results based on a reference string. |
fixedOrder | Boolean | Causes the query results to be returned in the order specified by the id argument. |
inReverse | Boolean | Causes the query results to be returned in reverse order. |
dateCreated | [String] | Narrows the query results based on the elements’ creation dates. |
dateUpdated | [String] | Narrows the query results based on the elements’ last-updated dates. |
offset | Int | Sets the offset for paginated results. |
limit | Int | Sets the limit for paginated results. |
orderBy | String | Sets the field the returned elements should be ordered by |
typeId | String | Narrows the query results based on the list type ID. |
userId | String | Narrows the query results based on the list’s owner. |
sessionId | String | Narrows the query results based on the list’s session ID. |
reference | String | Narrows the query results based on the list’s reference. |
default | Boolean | Narrows the query results based on whether it is the default list. |
ListInterface
interface#This is the interface implemented by all lists.
Field | Type | Description |
---|---|---|
id | ID | The id of the entity |
uid | String | The uid of the entity |
_count | Int | Return a number of related elements for a field. |
title | String | The element’s title. |
slug | String | The element’s slug. |
uri | String | The element’s URI. |
enabled | Boolean | Whether the element is enabled or not. |
archived | Boolean | Whether the element is archived or not. |
siteId | Int | The ID of the site the element is associated with. |
searchScore | String | The element’s search score, if the search parameter was used when querying for the element. |
trashed | Boolean | Whether the element has been soft-deleted or not. |
status | String | The element's status. |
dateCreated | DateTime | The date the element was created. |
dateUpdated | DateTime | The date the element was last updated. |
items | [ItemInterface] | The lists’ items. Accepts the same arguments as the wishlistItems query. |
{
wishlistItems (listId: 4562, limit: 1) {
element {
id
title
}
}
}
{
"data": {
"wishlistItems": [
{
"element": {
"id": "14931",
"title": "Some Entry"
}
},
]
}
}
wishlistItems
query#This query is used to query for items.
Argument | Type | Description |
---|---|---|
id | [QueryArgument] | Narrows the query results based on the elements’ IDs. |
uid | [String] | Narrows the query results based on the elements’ UIDs. |
status | [String] | Narrows the query results based on the elements’ statuses. |
archived | Boolean | Narrows the query results to only elements that have been archived. |
trashed | Boolean | Narrows the query results to only elements that have been soft-deleted. |
site | [String] | Determines which site(s) the elements should be queried in. Defaults to the current (requested) site. |
siteId | String | Determines which site(s) the elements should be queried in. Defaults to the current (requested) site. |
unique | Boolean | Determines whether only elements with unique IDs should be returned by the query. |
enabledForSite | Boolean | Narrows the query results based on whether the elements are enabled in the site they’re being queried in, per the site argument. |
title | [String] | Narrows the query results based on the elements’ titles. |
slug | [String] | Narrows the query results based on the elements’ slugs. |
uri | [String] | Narrows the query results based on the elements’ URIs. |
search | String | Narrows the query results to only elements that match a search query. |
relatedTo | [Int] | Narrows the query results to elements that relate to any of the provided element IDs. This argument is ignored, if relatedToAll is also used. |
relatedToAll | [Int] | Narrows the query results to elements that relate to all the provided element IDs. Using this argument will cause relatedTo argument to be ignored. |
ref | [String] | Narrows the query results based on a reference string. |
fixedOrder | Boolean | Causes the query results to be returned in the order specified by the id argument. |
inReverse | Boolean | Causes the query results to be returned in reverse order. |
dateCreated | [String] | Narrows the query results based on the elements’ creation dates. |
dateUpdated | [String] | Narrows the query results based on the elements’ last-updated dates. |
offset | Int | Sets the offset for paginated results. |
limit | Int | Sets the limit for paginated results. |
orderBy | String | Sets the field the returned elements should be ordered by |
listId | String | Narrows the query results based on the list ID. |
elementId | String | Narrows the query results based on the owner element ID. |
elementClass | String | Narrows the query results based on the owner element class. |
ItemInterface
interface#This is the interface implemented by all items.
Field | Type | Description |
---|---|---|
id | ID | The id of the entity |
uid | String | The uid of the entity |
_count | Int | Return a number of related elements for a field. |
title | String | The element’s title. |
slug | String | The element’s slug. |
uri | String | The element’s URI. |
enabled | Boolean | Whether the element is enabled or not. |
archived | Boolean | Whether the element is archived or not. |
siteId | Int | The ID of the site the element is associated with. |
searchScore | String | The element’s search score, if the search parameter was used when querying for the element. |
trashed | Boolean | Whether the element has been soft-deleted or not. |
status | String | The element's status. |
dateCreated | DateTime | The date the element was created. |
dateUpdated | DateTime | The date the element was last updated. |