1 min read

Magento 2 RESTful API Integration

Magento 2 Integration Guide For Your App

This document lists the requirements and gives an overview of mapping between Poq platform features and Magento 2 endpoints.

Prerequisites for Integration

  1. Admin username & password. We need this to create an admin token for some endpoints (to be used in POST /rest/default/V1/integration/admin/token to exchange for the token).
  2. Magento 2 Base URL
  3. Implementation of an endpoint for cart transfer to web checkout (detailed below)
  4. We will ask access to some endpoints if needed:
    • /search
    • /products
    • /customers
    • /customers/me
    • /integration/customer/token
    • /carts/mine
    • /categories/list (accessible only via admin token)
    • /categories/{categoryId} (accessible only via admin token)
    • /categories/{categoryId}/products
    • Note: More endpoints might be required depending on customisations of Magento for a particular client.

Supported features and integrations

Merchandising

Shop, Product List Page (including search and filters) and Product Details Page driven by Magento endpoints.

We need to have access to the endpoints in one of your Magento 2 environments that reflect the production environment to analyse and understand if they are returning the data that is required to implement in-scope functionality. Based on this analysis, we might need to ask for extra information to be returned by Magento 2 endpoints to enable app features in scope.

Cart and Web Checkout

Add to cart, modify cart and Cart Transfer (to web checkout) functionality driven by Magento endpoints.

We retrieve guest & authorized user token’s from Magento 2 and store them within the application. On expiration, we have a flow to renew the authorised users' token. The guest user token lifetime is almost two years and can be controlled from the Magento admin panel.

We support cart-sync between the application & the website. Added items from the application are shown on the website and vice-versa for logged-in users.

In order to use the web view flow, we need you to implement a custom endpoint on your side.

Implementation details

We pass quote_id and token depending on which type of user is.

Guest Cart Transfer
/carttransfer?quote=[quote_id]&token=[quote_id]

quote_id is the cartId created via /guest-carts

Registered Customer Cart Transfer
/carttransfer?token=[token_id]&quote=[quote_id]

token_id customer token created via /integration/customer/token quote_id user’s cart created (retrieved) via /carts/mine

Wishlist

Wishlist is stored on the Poq platform. By default, it is not integrated with Magento.

My Account

The ability to register, log in, get and update user details from the application.