Package Exports
- shopware-admin-api-client
- shopware-admin-api-client/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shopware-admin-api-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Admin JavaScript-API Client for Shopware 6
This code highly bases on the Administration Code and made JavaScript compatible.
Template Repository
You can also use the Shopware API Quickstart Template Repository to quickly get started.
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/7underlines/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.jsOnce you are done, you can stop the docker container with:
docker-compose downCreation of API Client
Installation
npm i shopware-admin-api-clientUsage
import {create} from 'shopware-admin-api-client';
// Create the API client
let api = await create('http://localhost', 'admin', 'shopware');
// 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'))Take a look at the index.js file in the quickstart template repository for a complete example.
Credits
- Soner Sayakci - Original Creator