Skip to Content

manufacturers

Fetches a paginated list of manufacturers.

Query Structure

query { manufacturers( first: Int, after: String, last: Int, before: String ) { edges { node { id name description } cursor } nodes { id name description } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } totalCount } }

Arguments

ArgumentTypeDescriptionRequiredDefault Value
firstIntReturns the first n elements.NoNone
afterStringReturns elements after this cursor.NoNone
lastIntReturns the last n elements.NoNone
beforeStringReturns elements before this cursor.NoNone

Return Type

ManufacturerConnection

A connection to a list of Manufacturer items.

FieldTypeDescription
edges[ManufacturerEdge]A list of edges, each containing a node and cursor. Optional.
nodes[Manufacturer]A list of Manufacturer nodes. Optional.
pageInfoPageInfo!Pagination information. Required.
totalCountIntThe total number of Manufacturer items. Optional.

ManufacturerEdge

FieldTypeDescription
nodeManufacturerThe Manufacturer item.
cursorStringCursor for pagination.

Manufacturer

FieldTypeDescription
idIntUnique identifier of the manufacturer.
nameStringName of the manufacturer.
descriptionStringDescription of the manufacturer.

PageInfo

FieldTypeDescription
hasNextPageBooleanIndicates if there is a next page.
hasPreviousPageBooleanIndicates if there is a previous page.
startCursorStringCursor to the first item in the page.
endCursorStringCursor to the last item in the page.

Examples

Basic Query

query { manufacturers(first: 5) { nodes { id name } totalCount } }

Advanced Query

query { manufacturers(first: 3, after: "YXJyYXljb25uZWN0aW9uOjI=") { edges { node { id name description } cursor } pageInfo { hasNextPage endCursor } totalCount } }

Field Selection

query { manufacturers(last: 4) { nodes { id name description } pageInfo { hasPreviousPage startCursor } } }

cURL Example

curl -X POST https://www.mystoreurl.com/graphql/0.8.0/ \ -H "Content-Type: application/json" \ -d '{"query":"query { manufacturers(first: 3) { nodes { id name description } totalCount } }"}'

JavaScript Example

async function fetchManufacturers() { const query = ` query { manufacturers(first: 3) { nodes { id name description } totalCount } } `; 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 result = await response.json(); if (result.errors) { console.error('GraphQL errors:', result.errors); return; } console.log('Manufacturers:', result.data.manufacturers.nodes); console.log('Total count:', result.data.manufacturers.totalCount); } catch (error) { console.error('Network error:', error); } } fetchManufacturers();

Response Format

{ "data": { "manufacturers": { "edges": [ { "node": { "id": 123, "name": "Acme Corp", "description": "Leading manufacturer of widgets." }, "cursor": "cursorString" } ], "nodes": [ { "id": 123, "name": "Acme Corp", "description": "Leading manufacturer of widgets." } ], "pageInfo": { "hasNextPage": true, "hasPreviousPage": false, "startCursor": "cursorString", "endCursor": "cursorString" }, "totalCount": 50 } } }

Error Handling

Error CodeDescriptionResolution
BAD_USER_INPUTInvalid argument values (e.g., negative first)Check and correct argument values.
INTERNAL_SERVER_ERRORServer encountered an unexpected conditionRetry the request after some time.
GRAPHQL_PARSE_FAILEDMalformed GraphQL queryVerify query syntax and structure.

In case of errors, the response will include an errors array with detailed messages:

{ "errors": [ { "message": "Argument 'first' must be a positive integer.", "locations": [{ "line": 2, "column": 18 }], "extensions": { "code": "BAD_USER_INPUT" } } ] }

Performance Considerations

  • Use pagination arguments (first, after, last, before) to limit the amount of data returned and improve response times.
  • Avoid requesting large numbers of items in a single query to reduce server load and latency.
  • Cache responses where possible, especially for queries that do not change frequently.
  • Monitor rate limits to avoid throttling (see API rate limiting policies).
  • Use cursor-based pagination (after/before) for efficient navigation through large datasets.

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.

  • ManufacturerConnection: The connection type for paginated manufacturer data.
  • ManufacturerEdge: Edge type containing a manufacturer node and cursor.
  • Manufacturer: Represents a manufacturer entity.
  • PageInfo: Contains pagination metadata.

Notes

  • Pagination cursors (after and before) are opaque strings returned in the cursor field of edges.
  • Use totalCount to understand the full size of the dataset.
  • The query supports both forward (first and after) and backward (last and before) pagination.
  • The edges field provides both the node and cursor, useful for implementing cursor-based pagination UI.
  • The nodes field provides a simplified list of manufacturer objects without cursors.
Last updated on