Git Product home page Git Product logo

mse-get-parent-product-configurable-by-child-product's Introduction

This is a magento 2 rest APi module for getting configurble product detail by Simple/Child Product Id

Magento2 REST API How to get parent product(configurable) by child product using

Get configurable product details by Child Id:

Request Type: GET

/V1/devbera-configurable/:childId

Replace :childId by your child Product Id.

Get configurable product details by Child Sku:

Request Type: GET

/V1/devbera-configurable/child-sku/:childSku

Replace :childSku by your child Product Sku.

Require files:

  1. app/code/Devbera/Configurable/etc/webapi.xml

  2. app/code/Devbera/Configurable/etc/di.xml

  3. app/code/Devbera/Configurable/Api/ConfigurableManagementInterface.php

  4. app/code/Devbera/Configurable/Api/ConfigurableManagementInterface.php

EXAMPLE

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://www.example.com/rest/V1/devbera-configurable/53",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer w747xkw1taogwzrnjccdotur1kyoia7i",
    "Content-Type: application/json",
    "Postman-Token: 6bfedc88-eca1-46f6-89fe-65343b846534",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.