Search by

yireo / magento2-additional-endpoints-graph-ql

yireo

Package info

github.com/yireo/Yireo_AdditionalEndpointsGraphQl

Type:magento2-module

pkg:composer/yireo/magento2-additional-endpoints-graph-ql

Fund package maintenance!

yireo

www.paypal.me/yireo

Statistics

Installs: 3 076

Dependents: 0

Suggesters: 0

Stars: 10

Open Issues: 0

0.0.3 2020-07-29 09:30 UTC

This package is auto-updated.

Last update: 2026-11-24 14:27:30 UTC


README

Magento version PHP version License Latest Version

This module offers some additional endpoints for loading information through GraphQL.

Installation

Use the following commands to install this module into Magento 2:

composer require yireo/magento2-additional-endpoints-graph-ql:@dev
bin/magento module:enable Yireo_AdditionalEndpointsGraphQl
bin/magento setup:upgrade

productById(Int! id) - Get a product by its ID

Only enabled products that are visible in the catalog or search, and that are assigned to the current website, are returned.

Example:

{
  productById(id:42){
    sku
    name
  }
}

productBySku(String! sku) - Get a product by its SKU

The same restrictions as for productById apply.

Example:

{
  productBySku(sku:"VA22-SI-NA"){
    sku
    name
  }
}

categoryById(Int! id) - Get a category by its ID

Only active categories within the root category of the current store are returned.

Example:

{
  categoryById(id:3){
    id
    name
  }
}

cmsBlock(String! identifier) - Get a CMS block by its identifier

Only active blocks of the current store view (or all store views) are returned. Directives in the content are processed.

Example:

{
  cmsBlock(identifier:"example"){
    title
    content
  }
}

cmsPages - Get all CMS pages

Returns the first 20 active pages of the current store view (or all store views). Directives in the content are processed.

Example:

{
  cmsPages {
    items {
      title
    }
  }
}

cmsWidget(Int! id) - Get a CMS widget by its ID

Only widget instances of a known widget type, assigned to the current store view (or all store views) and to the theme of the current store view, are returned. Only scalar parameters from an allowlist are returned (the $allowedParameters constructor argument of Yireo\AdditionalEndpointsGraphQl\Model\Resolver\CmsWidget, which you can change via di.xml).

Example:

{
  cmsWidget(id: 2) {
    id
    title
    html
    parameters {
      name
      value
    }
  }
}

validateCustomerToken - Validate a customer token

Send the customer token as Authorization: Bearer <token> header. The query returns true when the token belongs to a customer and is valid (not expired, not revoked). It returns false without a token. An invalid or expired token is rejected by Magento with an authorization error.

Example:

query validateToken {
  validateCustomerToken
}

Up to version 0.0.3, this query had a token argument. This argument was removed for security reasons.

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation