Every Falcon Extension provides its own part of the GraphQL Schema and in addition, an Extension requires to have an assigned API Provider that is able to communicate with the actual backend service. Every API Provider must implement all required methods of a specific Extension and be compatible with Queries, Mutations and types that are required by this Extension.
Currently, DEITY provides the following list of officially supported API providers:
Falcon Magento 2 API
If you used
create-falcon-app to generate your project,
may already be installed in which case you can skip the installation step.
This API requires DEITY Falcon PHP Module for Magento2 to be installed on your Magento instance.
Overview and installation
This API class realizes communication with your Magento 2 backend. It provides resolvers for queries and mutations required by Falcon Shop Extension. To add this API to your Falcon-based app install it in the server directory:
and add extension and api to the configuration of the server:
Lifecycle of the GraphQL request
This is a short overview of the way how authentication between Falcon Magento 2 API and Magento 2 backend works.
Falcon Magento 2 API provides implementation for endpoints that require authorization (customer related data) as well as endpoints that don't require a customer to be authenticated (product catalog etc).
Every incoming GraphQL request sets the context to the Falcon Server GraphQL resolver,
so all connected API providers would have access to it, including
Once a user signs in with his Magento 2 credentials his access token is stored in the
session so it can be used for interaction with Magento 2.
That way the API instance can fill in context with its own data that can be reused during query execution.
Falcon Magento 2 API gets the data from the
session (which is available as
To separate this session data from other API Providers' session data - API Provider base class has a short-cut method
to get session data from a specific session key (named as "api.name" value), so within API Provider class you can
access your session data via
That way all the required data (like auth token, currency, storeToken) is available in
this.session during query processing.
You can still access the whole session data via
Falcon Wordpress API