@thomaspeissl/shopware-admin-api-client

1.0.3 • Public • Published

Admin JavaScript-API Client for Shopware 6

This code highly bases on the Administration Code and made JavaScript compatible.

Running the examples with a local Shopware 6 instance

Usually, running the examples is quite simple if you have an environment that already has a functional git and docker installation.

To get started, simply try to execute the following in your terminal/shell:

git clone https://github.com/thomaspeissl/js-shopware-admin-api-client
cd js-shopware-admin-api-client
docker-compose up -d
# or docker compose up -d if you have a newer version of docker
# Visit http://localhost in your browser and refresh until the shop is available
npm i
node example/product-password.js

Once you are done, you can stop the docker container with:

docker-compose down

Creation of API Client

Installation

npm i @thomaspeissl/shopware-admin-api-client

Using Username and Password

import {createFromPasswordAndLogin} from '@thomaspeissl/shopware-admin-api-client';

let api = await createFromPasswordAndLogin('http://myshop.com', 'username', 'password', 1);

Using Integration

import {createFromIntegration} from '@thomaspeissl/shopware-admin-api-client';

let api = await createFromIntegration('http://myshop.com', 'client_id', 'client_secret', 1);

Usage

// Create repository
const productRepository = api.create('product');

// Access default context
const context = api.defaultContext();

// Acccess entity definition (contains the schema, required fields etc.)
const definition = api.EntityDefinition;

console.log(definition.get('product'))
console.log(definition.getRequiredFields('product'))

Credits

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @thomaspeissl/shopware-admin-api-client

Weekly Downloads

11

Version

1.0.3

License

MIT

Unpacked Size

79.2 kB

Total Files

24

Last publish

Collaborators

  • thomaspeissl