Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant