Magento api

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Magento api is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Build Magento 2 REST and GraphQL APIs — webapi.xml, schema.graphqls, resolvers, authentication, and ACL. Use when creating custom API endpoints, extending the GraphQL schema, or integrating external systems.

How to use this skill

Skill file

Magento 2 REST & GraphQL API Development

Before writing code

Fetch live docs:

  1. Fetch https://developer.adobe.com/commerce/webapi/ for Web API overview
  2. Fetch https://developer.adobe.com/commerce/webapi/graphql/develop/ for GraphQL development guide
  3. Fetch https://developer.adobe.com/commerce/webapi/get-started/ for authentication
  4. Web-search site:developer.adobe.com commerce php development components web-api for webapi.xml reference

REST API

How It Works

REST endpoints map HTTP methods + URL paths to service contract methods. Defined in etc/webapi.xml.

webapi.xml Structure

Each route defines:

Path parameters (:id) map to method parameters by name.

Authentication Types

| Type | Header | Use Case |

|------|--------|----------|

| Admin Token | Authorization: Bearer <token> | Back-office integrations |

| Customer Token | Authorization: Bearer <token> | Customer-facing apps |

| OAuth 1.0a | OAuth headers | Third-party integrations |

| Session | PHP session cookie | Storefront JS widgets |

| Anonymous | resource="anonymous" | Public endpoints |

Swagger/OpenAPI

Available at /rest/<store>/schema — auto-generated from webapi.xml and service contracts.

GraphQL API

How It Works

GraphQL uses a single endpoint (/graphql) with schema files and resolver classes.

Schema Files (schema.graphqls)

Define types, queries, and mutations in etc/schema.graphqls:

Resolver Classes

Implement Magento\Framework\GraphQl\Query\ResolverInterface:

Identity for Cache

Implement Magento\Framework\GraphQl\Query\Resolver\IdentityInterface for full-page cache invalidation of GraphQL responses.

GraphQL Authorization

ACL (Access Control List)

acl.xml

Defines the resource tree for authorization:

Best Practices

Fetch the Web API and GraphQL development docs for exact XML schema, resolver signatures, and authentication patterns before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.