Skip to content

API Client packages

API Client packages

Documentation related to the API Client package.

INFO

A new version of the API Client is currently in development (see NPM).
Features are TypeScript autocompletion and generated types based on the environment.

Additional docs about the API Client

Associations
Not all of the associations are added to the response by default. Some of them have to be added manually.
Storefront URL
Storefront URL is a parameter that is included in some API requests to specify which language, domain, etc., should be used when the backend sends emails.

List of all public methods

Exported within @shopware-pwa/api-client package

CMS

namedescription
getCmsPage deprecatedthe method is becoming obsolete and will be removed in the future as the SwagShopwarePwa plugin won't be needed.
getLandingPageFetches a landing page entity
getSeoUrlan array of SEO URLs for given entity
getSeoUrlsan array of SEO URLs for given entityCan be used for other languages as well by providing the languageId

Cart

namedescription
addCartItemsAdds multiple items to the cart.Accepts every type of cart item.
addProductToCartAdds specific quantity of the product to the cart by productId. It creates a new cart line item.Warning: This method does not change the state of the cart in any way if productId already exists in a cart. For changing the quantity use addQuantityToCartLineItem() or changeCartLineItemQuantity() methods.
addPromotionCodeAdds new promotion code to the cart by its code.Promotion code is being added as separate cart item line.
changeCartItemQuantityChanges the current quantity in specific cart line item to given quantity.Example: If current quantity is 3 and you pass 2 as quantity parameter, you will get a new cart's state with quantity 2.
clearCartWhen no sw-context-token given then this method return an empty cart with the new sw-context-token.When sw-context-token given then this method simply returns the current state of the cart.As the purpose of this method is not clear we recommend to use
getCartGets the current cart for the sw-context-token.
removeCartItemDeletes the cart line item by id.This method may be used for deleting "product" type item lines as well as "promotion" type item lines.

Category

namedescription
getCategoriesGet a list of categories by provided search criteria.
getCategoryGet a single category by its id.

Checkout

namedescription
cancelOrderCancel an order
changeOrderPaymentMethodChange payment method for given order
createOrderCreates an order for logged in and guest users
getOrderDetailsGet order details
handlePayment

Context

namedescription
getAvailableCountriesGet all available countries
getAvailableCurrenciesGet all available currencies
getAvailableLanguagesGet all available languages
getAvailablePaymentMethodsget all available payment methods
getAvailableSalutationsGet all available salutations
getAvailableShippingMethodsGet all available shipping methods
getPaymentMethodDetailsGet payment method details
getSessionContextLoads session context, containing all session-related data.
getShippingMethodDetailsGet Shipping method details
getUserCountryGet the current session's country
getUserSalutationGet the current session's salutation
setCurrentBillingAddressSet the current session's billing address to correspoding to id
setCurrentCountrySet the current session's country
setCurrentCurrencySet the current session's currency to correspoding to id
setCurrentLanguageSet the current session's language to corresponding to id
setCurrentPaymentMethodSet the current session's payment method to correspoding to id
setCurrentShippingAddressSet the current session's shipping address to correspoding to id
setCurrentShippingMethodSet the current session's shipping method to correspoding to id

Customer

namedescription
CustomerRegisterResponse
CustomerResetPasswordParam
CustomerUpdateEmailParam
CustomerUpdatePasswordParam
CustomerUpdateProfileParam
confirmAccountRegistrationConfirm an account registration in double opt-in mode
confirmPasswordResetConfirm a customer's password reset. Set new password for account.
createCustomerAddressCreate an address and respond the new address's id
deleteCustomerAddressDelete's the customer's address by id
getCustomerGet customer's object
getCustomerAddressGet the customer's address by id
getCustomerAddressesGet all customer's addresses
getCustomerOrdersGet all customer's orders
isNewsletterSubscriberChecking if user is newsletter subscriber
loginLogin user to shopware instance.
logoutEnd up the user session.
registerRegister a customer
resetPasswordReset a customer's password
setDefaultCustomerBillingAddressSet address as default
setDefaultCustomerPaymentMethodSet payment method under provided ID as default
setDefaultCustomerShippingAddressSet address as default
updateCustomerAddressUpdate an address for specific ID
updateEmailUpdate a customer's email
updatePasswordUpdate a customer's password
updateProfileUpdate a customer's profile data

Forms

namedescription
ContactFormData
NewsletterSubscribeData
newsletterSubscribeSubscribes to newsletter
newsletterUnsubscribeUnsubscribe from newsletter
sendContactFormSends contact form
namedescription
GetStoreNavigationParams
getStoreNavigationGet a list of categories by provided search criteria.

Product

namedescription
addProductReviewAdd a review to specific product by its ID
getCategoryProductsGet default amount of products and listing configuration for given category
getProductGet the product with passed productId
getProductCrossSellingGet the product with passed productId
getProductReviewsGet product reviews
getProductsGet default amount of products
namedescription
searchProductsSearch for products based on criteria.From: Shopware 6.4
searchSuggestedProductsSearch for suggested products based on criteria.From: Shopware 6.4

Wishlist

namedescription
addWishlistProductAdd a product with a specific ID to the wishlist
getWishlistProductsFetch a current Wishlist with added products
mergeWishlistProductsMerge the current Wishlist with a products with provided IDs
removeWishlistProductDelete a product with a specific ID from the wishlist

Endpoints

namedescription
getAddWishlistProductEndpoint
getCancelOrderEndpoint
getCategoryDetailsEndpoint
getCategoryEndpoint
getChangeOrderPaymentMethodEndpoint
getCheckoutCartEndpoint
getCheckoutCartLineItemEndpoint
getCheckoutOrderEndpoint
getCmsEndpoint
getConfirmPasswordResetEndpoint
getContactFormEndpoint
getContextCountryEndpoint
getContextCurrencyEndpoint
getContextEndpoint
getContextLanguageEndpoint
getContextPaymentMethodEndpoint
getContextSalutationEndpoint
getContextShippingMethodEndpoint
getCustomerAccountConfirmEndpoint
getCustomerAddAddressEndpoint
getCustomerAddressEndpoint
getCustomerDefaultBillingAddressEndpoint
getCustomerDefaultShippingAddressEndpoint
getCustomerDetailsUpdateEndpoint
getCustomerEndpoint
getCustomerLoginEndpoint
getCustomerLogoutEndpoint
getCustomerOrderEndpoint
getCustomerRegisterEndpoint
getCustomerResetPasswordEndpoint
getCustomerUpdateEmailEndpoint
getCustomerUpdatePasswordEndpoint
getCustomerUpdatePaymentMethodEndpoint
getDocumentDownloadEndpoint
getGetWishlistProductsEndpoint
getLandingPageDetailsEndpoint
getMergeWishlistProductsEndpoint
getNewsletterRecipientEndpoint
getNewsletterSubscribeEndpoint
getNewsletterUnsubscribeEndpoint
getOrderDownloadsEndpoint
getPageResolverEndpoint
getProductCrossSellingEndpoint
getProductDetailsEndpoint
getProductEndpoint
getProductListingEndpoint
getProductReviewsEndpoint
getRemoveWishlistProductEndpoint
getSearchEndpoint
getSeoUrlEndpoint
getStoreNavigationEndpoint
getStoreNewsletterConfirmEndpoint
getStoreNewsletterSubscribeEndpoint
getStoreNewsletterUnsubscribeEndpoint
getSuggestSearchEndpoint
handlePaymentEndpoint

Other

namedescription
ConfigChangedArgs
ShopwareApiInstance
ClientSettings
config
createInstance
getDocumentDownloadDownload selected document
getOrderDownloadsGet order downloads (file)
getSitemapGet sitemap
getSitemapEndpoint
invokeGetInvoke custom GET request to shopware API. Mostly for plugins usage.You can skip domain and pass only endpoint ex.
invokePostInvoke custom POST request to shopware API. Mostly for plugins usage.You can skip domain and pass only endpoint ex.
onConfigChange
setupSetup configuration. Merge default values with provided in param.This method will override existing config. For config update invoke update method.
updateUpdate current configuration. This will change only provided values.