manufacturer
Get a single manufacturer by ID.
Query Structure
query {
manufacturer(id: ID!) {
seoDescription
seoTitle
seoKeywords
id
title
allProductsCount
products {
# ProductConnection fields can be selected here
}
image
filters {
# Filter fields can be selected here
}
}
}
Arguments
Argument | Type | Description | Required | Default |
---|---|---|---|---|
id | ID! | The ID of the manufacturer to retrieve | Yes | N/A |
Return Type
Manufacturer
Describes a manufacturer.
Field | Type | Description |
---|---|---|
seoDescription | String (optional) | Returns description for search engines. |
seoTitle | String (optional) | Returns title for search engines. |
seoKeywords | String (optional) | Returns keywords for search engines. |
id | Int (optional) | Returns the ID of the manufacturer. |
title | String (optional) | Returns the title of the manufacturer. |
allProductsCount | Int (optional) | Returns the total amount of products for this manufacturer. |
products | ProductConnection (optional) | Returns the products associated with this manufacturer. |
image | String (optional) | Returns the image URL of the manufacturer. |
filters | [Filter] (optional) | Returns the available filters for this manufacturer, null if none is set. |
Examples
Basic Query
query {
manufacturer(id: 12345) {
id
title
seoDescription
}
}
Advanced Query
query {
manufacturer(id: 12345) {
id
title
seoTitle
seoKeywords
seoDescription
allProductsCount
image
filters {
id
name
type
values {
id
label
}
}
products {
edges {
node {
id
title
price
available
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
Field Selection
query {
manufacturer(id: 12345) {
title
allProductsCount
products {
edges {
node {
id
title
price
}
}
}
}
}
cURL Example
curl -X POST https://www.mystoreurl.com/graphql/0.8.0/ \
-H "Content-Type: application/json" \
-d '{"query":"query { manufacturer(id: 12345) { id title seoDescription } }"}'
JavaScript Example
async function fetchManufacturer(manufacturerId) {
const query = `
query {
manufacturer(id: ${manufacturerId}) {
id
title
seoDescription
}
}
`;
try {
const response = await fetch('https://www.mystoreurl.com/graphql/0.8.0/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ query }),
});
const { data, errors } = await response.json();
if (errors) {
console.error('GraphQL errors:', errors);
return null;
}
return data.manufacturer;
} catch (error) {
console.error('Network error:', error);
return null;
}
}
// Usage example
fetchManufacturer(12345).then(manufacturer => {
if (manufacturer) {
console.log('Manufacturer:', manufacturer);
} else {
console.log('Failed to fetch manufacturer.');
}
});
Response Format
The response contains a manufacturer
object with the requested fields. Example:
{
"data": {
"manufacturer": {
"id": 12345,
"title": "Acme Corp",
"seoDescription": "Leading manufacturer of quality products.",
"seoTitle": "Acme Corp - Quality Products",
"seoKeywords": "acme, manufacturer, quality",
"allProductsCount": 150,
"image": "https://cdn.mystoreurl.com/images/manufacturers/acme.jpg",
"filters": [
{
"id": 1,
"name": "Color",
"type": "dropdown",
"values": [
{ "id": 10, "label": "Red" },
{ "id": 11, "label": "Blue" }
]
}
],
"products": {
"edges": [
{
"node": {
"id": 1001,
"title": "Acme Widget",
"price": 19.99,
"available": true
}
}
],
"pageInfo": {
"hasNextPage": true,
"endCursor": "cursor123"
}
}
}
}
}
Error Handling
Error Code | Description | Handling Recommendation |
---|---|---|
BAD_USER_INPUT | The provided id argument is invalid or missing. | Validate the id before querying. |
NOT_FOUND | No manufacturer found with the specified id . | Inform the user that the manufacturer does not exist. |
INTERNAL_SERVER_ERROR | Unexpected server error occurred. | Retry after some delay or contact support. |
Errors are returned in the errors
array in the GraphQL response. Always check for errors before processing data.
Performance Considerations
- Use field selection to request only necessary fields to reduce response size and improve performance.
- When querying
products
undermanufacturer
, use pagination to limit the number of returned products. - Avoid requesting deeply nested fields unless required.
- The API enforces rate limiting; excessive requests may result in throttling.
- Cache responses where possible, especially for manufacturer data that changes infrequently.
Authentication
This API currently does not require authentication. However, authentication requirements may be introduced in future versions. Monitor API updates for any changes to authentication requirements.
Related Types
- Manufacturer: The main return type for this query.
- ProductConnection: Connection type for paginated products related to the manufacturer.
- Filter: Filter objects available for the manufacturer.
Notes
- The
filters
field may returnnull
if no filters are set for the manufacturer. - The
products
field supports pagination; useedges
andpageInfo
to navigate large product lists. - The
id
argument is mandatory and must be a valid integer ID of an existing manufacturer. - Always handle possible null or missing fields gracefully in your client application.
Last updated on