All Projects → treffner → v-shopware-api-client

treffner / v-shopware-api-client

Licence: AGPL-3.0 license
The reliable way to import and update a bazillion products.

Programming Languages

V
68 projects
Coq
218 projects
AMPL
153 projects

Projects that are alternatives of or similar to v-shopware-api-client

production
Shopware 6 production template
Stars: ✭ 156 (+680%)
Mutual labels:  ecommerce, shopware, shopware6
hubble-frontend-pwa
E-Commerce PWA Frontend
Stars: ✭ 43 (+115%)
Mutual labels:  ecommerce, shopware, shopware6
RecentlyViewedProduct
Recently viewed products plugin for SW6
Stars: ✭ 20 (+0%)
Mutual labels:  shopware, shopware6
sw6-media-optimizer
Image Optimizer for Shopware 6 💙
Stars: ✭ 18 (-10%)
Mutual labels:  shopware, shopware6
square-python-sdk
Python client library for the Square API
Stars: ✭ 72 (+260%)
Mutual labels:  ecommerce, api-client
FroshProductCompare
A Plugin for Shopware 6 - Ecommerce Platform
Stars: ✭ 27 (+35%)
Mutual labels:  shopware, shopware6
composer-project
Skeleton for Shopware projects with composer
Stars: ✭ 72 (+260%)
Mutual labels:  ecommerce, shopware
shopware6-advanced-banners
Advanced Banners (Digital Publishing) for Shopware 6 💙
Stars: ✭ 30 (+50%)
Mutual labels:  shopware, shopware6
downtown
With our portal, we want to support local authorities and merchants. We want to connect merchants with closed stores to their customers. And we want to keep in mind, that not every merchant has a sophisticated digital strategy - or even a homepage.
Stars: ✭ 45 (+125%)
Mutual labels:  ecommerce, shopware
Vue Storefront
The open-source frontend for any eCommerce. Built with a PWA and headless approach, using a modern JS stack. We have custom integrations with Magento, commercetools, Shopware and Shopify and total coverage is just a matter of time. The API approach also allows you to merge VSF with any third-party tool like CMS, payment gateways or analytics. Ne…
Stars: ✭ 9,111 (+45455%)
Mutual labels:  ecommerce, shopware
docs
No description or website provided.
Stars: ✭ 28 (+40%)
Mutual labels:  shopware, shopware6
shopware-cms-generator
Generate a CMS element scaffolding within seconds.
Stars: ✭ 26 (+30%)
Mutual labels:  shopware, shopware6
WbmTagManager
Shopware 5 Plugin for Google Tag Manager integration and dataLayer configuration
Stars: ✭ 24 (+20%)
Mutual labels:  shopware
commercetools-sync-java
Java library for importing and syncing (taking care of changes) data into one or more commercetools projects from external data files or from another commercetools project.
Stars: ✭ 26 (+30%)
Mutual labels:  ecommerce
JSON-API-Client
Abstract client-side php implementation of the json api specification (jsonapi.org)
Stars: ✭ 17 (-15%)
Mutual labels:  api-client
grav-skeleton-gravcart
The Grav Shopping Cart skeleton
Stars: ✭ 11 (-45%)
Mutual labels:  ecommerce
pazaryeri-parasut
N11, Gittigidiyor, Hepsiburada Pazaryerlerini; Paraşüt Web Tabanlı Fatura ve Tahsilat Yönetimine bağlayan API
Stars: ✭ 44 (+120%)
Mutual labels:  ecommerce
pyFireEye
Python API bindings for FireEye Products
Stars: ✭ 12 (-40%)
Mutual labels:  api-client
qvapay-python
Non official, but friendly QvaPay library for the Python language.
Stars: ✭ 18 (-10%)
Mutual labels:  api-client
DummyJSON
DummyJSON provides different types of REST Endpoints filled with JSON data which you can use in developing the frontend with your favorite framework and library without worrying about writing a backend.
Stars: ✭ 213 (+965%)
Mutual labels:  api-client

V Shopware 6 admin API client

This is a pure V module that can be used to communicate with Shopware 6.

Requires at least Shopware version 6.4.

Shopware Admin API credentials can be generated in the shopware backend (Settings->System->Integrations).

Shopware 6 Admin API Endpoint Reference

Shopware 6 Developer Documentation

I recommend to configure the api credentials via .env - take a look at my dotenv module.

Features

  • built-in oauth token renewal
  • useful helper functions for file upload and search

Why V

  • can handle big imports that may take several hours
  • parallel processing
  • errors during compile time

Installation

Install and use this module as a dependency via v.mod (recommended)

Run "v init" to auto-generate your v.mod file.

v init

Then edit the dependencies in your v.mod file to look like this:

dependencies: ['treffner.shopwareac']

And install with:

v install

To update your dependencies later just run "v install" again.

Or via VPM:

v install treffner.shopwareac

Or through Git:

git clone https://github.com/thomaspeissl/v-shopware-api-client.git ~/.vmodules/treffner/shopwareac

Running the examples

Fill in your api credentials in the code placeholders an then run.

cd examples
v run simple.v
v run search.v

Example

This example gets products from the admin api and prints out their product ids.

module main

import treffner.shopwareac
import json

struct ShopResponse {
	data []ShopResponseData
}
struct ShopResponseData {
	id string
}

fn main() {
	mut sw_api := shopwareac.Login{ // mut is needed for the automated oauth2 token renewal
		api_url: 'http://localhost:8000/api/'
		client_id: 'XXXXXXXXXXXXXXXXXXXXXXXXXX' // get this from Shopware 6 backend Settings->System->Integrations
		client_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
	}
	response := sw_api.get('product')
	response_data := json.decode(ShopResponse, response) or { panic(err) }
	for product in response_data.data {
		println(product.id)
	}
}

Module documentation

Contents

date_time

fn date_time() string

current time formatted for Shopware date time custom fields eg. "2022-01-16T12:00:00+00:00"

[Return to contents]

encode

fn encode(s string) string

Percent-encoding reserved characters eg. for filter parameters

[Return to contents]

strip

fn strip(s string) string

strip not allowed chars

[Return to contents]

Login

struct Login {
mut:
	token AuthToken
pub:
	client_id     string
	client_secret string
pub mut:
	api_url string
}

[Return to contents]

add_media_to_product

fn (mut l Login) add_media_to_product(media_id string, product_id string, set_as_cover bool, position int)

add_media_to_product position should begin with 0

[Return to contents]

auth

fn (mut l Login) auth() bool

auth get's called automatic and renews the oauth token if needed

[Return to contents]

delete

fn (mut l Login) delete(endpoint string, id string)

[Return to contents]

find_category_by_customfield

fn (mut l Login) find_category_by_customfield(field string, value string) ?ShopResponseData

[Return to contents]

find_media_by_name

fn (mut l Login) find_media_by_name(name string) ?ShopResponseData

[Return to contents]

find_product_by_customfield

fn (mut l Login) find_product_by_customfield(field string, value string) ?ShopResponseData

[Return to contents]

find_product_by_productnumber

fn (mut l Login) find_product_by_productnumber(productnumber string) ?ShopResponseData

[Return to contents]

find_property_by_name

fn (mut l Login) find_property_by_name(name string, group string) ?ShopResponseData

[Return to contents]

find_subcategory_by_name

fn (mut l Login) find_subcategory_by_name(name string, parent string) ?ShopResponseData

[Return to contents]

get

fn (mut l Login) get(endpoint string) string

[Return to contents]

get_default_media_folder

fn (mut l Login) get_default_media_folder() string

[Return to contents]

get_default_sales_channel

fn (mut l Login) get_default_sales_channel() string

[Return to contents]

get_default_tax

fn (mut l Login) get_default_tax() string

[Return to contents]

get_last_sync

fn (mut l Login) get_last_sync() string

get_last_sync returns the last sync payload

[Return to contents]

get_raw

fn (mut l Login) get_raw(endpoint string) http.Response

[Return to contents]

patch

fn (mut l Login) patch(endpoint string, data string)

[Return to contents]

post

fn (mut l Login) post(endpoint string, data string) string

post returns the id of the created content on success

[Return to contents]

resend_sync

fn (mut l Login) resend_sync()

resend_sync sends the last sync operation (sync saves data into a file) again to the shop api - useful for debugging or temporary errors

[Return to contents]

search

fn (mut l Login) search(entity string, data string) string

[Return to contents]

sync

fn (mut l Login) sync(data string) string

sync API is an add-on to the Admin API that allows you to perform multiple write operations (creating/updating and deleting) simultaneously

[Return to contents]

sync_delete

fn (mut l Login) sync_delete(entity string, data []string) string

sync_delete is a shorthand function for sync with data chunking for large arrays

[Return to contents]

sync_upsert

fn (mut l Login) sync_upsert(entity string, data []string) string

sync_upsert is a shorthand function for sync with data chunking for large arrays

[Return to contents]

update_media_from_url

fn (mut l Login) update_media_from_url(media_id string, url string)

Attach resource data to the media object from the given url

[Return to contents]

upload

fn (mut l Login) upload(file_url string, name string, media_folder_id string) ?string

upload returns the mediaId of the uploaded file on success

[Return to contents]

upload_file

fn (mut l Login) upload_file(media_id string, name string, _ext string, data string) ?

upload_file via binary blob

[Return to contents]

ShopResponseData

struct ShopResponseData {
pub:
	id         string
	attributes Attributes
}

[Return to contents]

Powered by vdoc. Generated on: 27 Sep 2022 12:26:45

v doc -f md .

License

AGPL-3.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].