Skip to content

invokePost

invokePost

Definition

Invoke custom POST request to shopware API. Mostly for plugins usage. You can skip domain and pass only endpoint ex. /api/my/endpoint

Signature

ts
export function invokePost<T>(
  {
    address,
    payload,
  }: {
    address: string;
    payload?: unknown;
  },
  contextInstance: ShopwareApiInstance = defaultInstance,
): Promise<AxiosResponse<T>>

Parameters

NameTypeDescription
{ address, payload, }
{
    address: string;
    payload?: unknown;
  }
endpoint address
contextInstance
ShopwareApiInstance
instance of the api client (by default it's an Axios instance)

Return type

ts
Promise<AxiosResponse<T>>

Usage example

WARNING

Example is generated automatically. Sometimes it's required to be adjusted to your needs.

Open in StackBlitz