makaira/magento2-connect

Makaira Headless Extension for Magento 2

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:magento2-module

dev-stable 2021-03-30 15:35 UTC

This package is not auto-updated.

Last update: 2024-11-20 09:13:48 UTC


README

Packagist Version Build Status

This document helps you integrate the Makaira Headless Extension into your Magento 2 Shop.

Table of contents

Requirements

This module supports:

  • Magento 2 version 2.2 and higher
  • PHP version 7.1 and higher
    Warning: PHP 7.0 is not supported

Installation

To install module, open your terminal and run the command:

composer require makaira/magento2-connect:dev-main

Refer to Composer manual for more information. If, for some reason, composer is not available globally, proceed to install it following the instructions available on the project website.

Activating the Module

From the root of your Magento 2 installation, enter these commands in sequence:

php bin/magento module:enable Makaira_Headless
php bin/magento setup:upgrade

As a final step, check the module activation by running:

php bin/magento module:status

The module should now appear in the upper list List of enabled modules.

That's it, you are ready to go!

API endpoint examples

All examples below are of content type application/json. PUT, DELETE and POST methods require a raw body with valid JSON.

Cart actions

Get all cart articles

GET /makaira/cart/

Response:
{
    "success": true,
    "cart": {
        "items": [],
        "total": 0
    }
}

Add article to cart

POST /makaira/cart/

Body:
{
    "sku": "24-MB04",
    "quantity": "1"
}

Response:
{
    "success": true,
    "cart": {
        "items": [
            {
                "sku": "24-MB04",
                "name": "Strive Shoulder Pack",
                "quantity": 1,
                "price": 32
            }
        ],
        "total": 32
    }
}

Delete article from cart

DELETE /makaira/cart/

Body:
{
    "sku": "24-MB04"
}

Response:
{
    "success": true,
    "message": "Der Artikel wurde entfernt.",
    "sku": "24-MB04"
}

Change article quantity in cart

PUT /makaira/cart/

Body:
{
    "sku": "24-MB04",
    "quantity": "3"
}

Response:
{
    "success": true,
    "cart": {
        "items": [
            {
                "sku": "24-MB04",
                "name": "Strive Shoulder Pack",
                "quantity": 3,
                "price": 32
            }
        ],
        "total": 96
    }
}

User actions

Get currently logged in user

GET /makaira/user/

Response:
{
    "success": true,
    "user": null
}