Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Document how to interact with Magento2’s REST API #46

Open
real34 opened this issue Mar 8, 2019 · 1 comment
Open

Document how to interact with Magento2’s REST API #46

real34 opened this issue Mar 8, 2019 · 1 comment

Comments

@real34
Copy link
Member

real34 commented Mar 8, 2019

Gather documentation from our old tools, and update this issue with relevant documentation information before adding them to official developers documentation.

Goal: allow developers to interact with exposed REST API from Magento2 modules


Here are some notes:

  • When M2.3 will have been integrated (and if it seems relevant) recommend to implement a GraphQL API directly so it could be proxied directly (+ write another documentation page to explain how)
  • Fallbacks when logged out (to refresh a token)
  • scopes (Magento)
  • admin API (integration)
// src/server/model/magento2Connector/factories.js
module.exports = {
  makeUserClientFromRequest,
  makeAdminClientFromRequest,
  makeAuthServiceFromRequest,
  makeSearchDataSourceFromRequest,
  makeCartUrlBuilderFromRequest,
  makeStoreConfigFromRequest
};
const {
  makeUserClientFromRequest,
  makeAuthServiceFromRequest
} = require("../magento2Connector/factories");

    const axiosInstance = makeUserClientFromRequest(
      config.magentoEndpoint,
      req
    );
    const authService = makeAuthServiceFromRequest(req);
@real34
Copy link
Member Author

real34 commented Apr 23, 2019

cartUrlBuilder: see https://front-commerce.slack.com/archives/C929PBHUZ/p1556019299007500

    const cartUrlBuilder = makeCartUrlBuilderFromRequest(
      config.magentoEndpoint,
      req
    );
    cartUrlBuilder.fetchCart().toPromise().then(cart => ...);
    // ou
   cartUrlBuilder.cartId().toPromise().then(id => ...);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant