Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including magento2-swagger with all npm packages installed. Try it out:

var magento2Swagger = require("magento2-swagger")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

magento2-swagger v0.0.8

Magento 2 REST API - code generated from official Swagger spec

Magento 2 REST API client automatically generated from Swagger specification

Magento 2 implements Swagger providing a JSON Schema of the REST endpoints, this package compiles the JSON into classes and methods using templates (see inside the templates/ directory) for consuming the API in a NodeJS applicaton.

Installation

npm install magento2-swagger --save

Example usage

A full specification of all the endpoints in this packages can be found in the Magento 2 Dev Docs

var magentoSwagger = require('magento2-swagger').Magento;

var magento = new magentoSwagger('http://www.example.com/rest');

magento.catalogCategoryManagementV1GetTreeGet().done(function (response) {
  console.log(response.body);
});
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free