Queries
links
Your saved links to products and categories, with their current URL.
links returns your links to products and categories with their current URL, in the same order. Use it if you store links in your own content.
links(links: [StorefrontLinkInput!]!): [StorefrontLink!]Arguments
| Field | Type | Rule |
|---|---|---|
links | [StorefrontLinkInput!]! | Up to 100 links. |
links[].url | String! | The saved URL or path, 1 to 2048 characters. |
links[].reference | StorefrontLinkReferenceInput | Optional: the resource type and id. |
type is a StorefrontLinkKind: product, category, brand or collection.
- Only links to products and categories are updated. External links stay as they are.
- The query and the fragment are kept, such as
?size=m.
StorefrontLink
| Field | Type | Description |
|---|---|---|
url | String! | The current URL. |
reference | StorefrontLinkReference | type and id of the resource it points to, or null. |
Example
query Links($links: [StorefrontLinkInput!]!) {
links(links: $links) {
url
reference { type id }
}
}curl --request POST "https://storefront.ecomiq.pe/graphql" \
--header "Content-Type: application/json" \
--header "x-Store-Domain: my-store" \
--data-binary '{
"query": "query Links($links: [StorefrontLinkInput!]!) { links(links: $links) { url reference { type id } } }",
"variables": { "links": [{ "url": "/products/blue-t-shirt?size=m" }] }
}'{
"data": {
"links": [
{
"url": "/products/blue-pima-t-shirt?size=m",
"reference": { "type": "product", "id": "7204558912004322039" }
}
]
}
}Errors
| Code | Cause |
|---|---|
BAD_USER_INPUT | More than 100 links, an empty URL or one longer than 2048 characters, or an invalid reference. |
NOT_FOUND | The store no longer exists. |
STORE_CONTEXT_REQUIRED | x-Store-Domain is missing or doesn't match a store. |
REST equivalent
POST / takes { "links": [...] } and responds with the links in links.
Last updated: