Skip to content

Commit

Permalink
Merge pull request #1184 from shopware/dx-489/add-req-headers
Browse files Browse the repository at this point in the history
Update request headers
  • Loading branch information
sushmangupta authored Nov 21, 2023
2 parents a68e707 + a2edd7e commit 7b8e269
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion guides/integrations-api/general-concepts/request-headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,39 @@ POST /api/search/product

## sw-skip-trigger-flow

Flows are an essential part of Shopware and are triggered by events like the creation of a customer. When migrating from another ecommerce platform to shopware, you might import hundreds of thousands of customers via the sync API. In that case, you don't want to trigger the `send email on customer creation` flow. To avoid this behavior, you can pass the `sw-skip-trigger-flow` header.
Flows are an essential part of Shopware and are triggered by events like the creation of a customer. When migrating from another e-commerce platform to shopware, you might import hundreds of thousands of customers via the sync API. In that case, you don't want to trigger the `send email on customer creation` flow. To avoid this behavior, you can pass the `sw-skip-trigger-flow` header.

```bash
POST /api/_action/sync
--header 'sw-skip-trigger-flow: 1'
```

## sw-access-token

Any request to the Store API needs an Authentication with a `sw-access-token`. Refer to [Authentication & Authorization](https://shopware.stoplight.io/docs/store-api/8e1d78252fa6f-authentication-and-authorisation) section of Store API for more details on this.

## sw-context-token

The `sw-context-token` is used to recognize your customers in the context of the Store API. Refer to [Authentication & Authorization](https://shopware.stoplight.io/docs/store-api/8e1d78252fa6f-authentication-and-authorisation) section of Store API for more details on this.

## sw-currency-id

When calling the API, a client can include the `sw-currency-id` header to indicate the currency in which it wants to receive prices. For example, if the header is set to "USD," the API might respond with prices converted to U.S. dollars. This header is associated with the currency settings in the admin panel. It allows clients to dynamically switch between different currencies based on their preferences.

```bash
POST /api/search/order
--header 'sw-currency-id: 1987f5c352434028802556e065cd5b1e'
```

## sw-include-seo-urls

This header indicates whether SEO-friendly URLs for products or categories should be included in the API response. If an API request is made and the `sw-include-seo-urls` header is set, the API response will include all the configured SEO URLs for the specified product. This can provide additional information to the client about the various SEO-friendly paths associated with the product, allowing for better SEO management or customization.

```bash
POST /api/search/product
--header 'sw-include-seo-urls: 1'
```

## sw-app-integration-id

The `sw-app-integration-id` enables seamless connection and data exchange between different software components. This header is required for correct permission checks performed by the backend when fetching or manipulating data. It overrides the default behavior and uses the privileges provided by the app. This is used in the Admin Extension SDK for the [Repository Data Handling](https://shopware.github.io/admin-extension-sdk/docs/guide/api-reference/data/repository). But the developer itself doesn’t need to care about it because it is handled automatically by the admin.

0 comments on commit 7b8e269

Please sign in to comment.