# Great Headless API Useless

**URL:** <https://forum.shopware.com/t/great-headless-api-useless/66991>\
**Category:** Programming (EN)\
**Created:** [16. Mai 2020 um 12:21 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991 "2020-05-16T12:21:46Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:21 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/1 "2020-05-16T12:21:46Z")

</div>

Hey folks!

I am trying to get up the basic API endpoint&nbsp;

GET http:///store-api/v1/context

I set up a GET Request with the URL in Postman and added as header the&nbsp;sw-access-key. But I always get „Not Found“. How the hell is it possible? Or is the great headless sh\*t from shopware, e.g. I want to query a description for a product only accessible via a plugin and hence useless for a PWA?

Here my simple config in Postman for the GET request:

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/6/6a6415fac10deb8304f7ac8e124bbfb32b05a497.png)

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:25 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/2 "2020-05-16T12:25:16Z")

</div>

I tried now nearly 200 calls. Nothing works.

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:31 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/3 "2020-05-16T12:31:06Z")

</div>

Sometimes I get:&nbsp;{“errors”:[{“status”:“412”,“code”:“FRAMEWORK\_\_ROUTING\_SALES\_CHANNEL\_NOT\_FOUND”,“title”:“Precondition Failed”,“detail”:“No matching sales channel found.”,“meta”:{“parameters”:}}]} when I try this URL:

http://…/sales-channel-api/v1/product

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:35 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/4 "2020-05-16T12:35:32Z")

</div>

But I would be happy if I can get up running the context call to get all the sales channels, bcz the documentation says this:

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/8/8c18a1fcc91a0327256dcb9acd8ecc1675136ec1.png)

Maybe someone noticed that the JSON here is not valid. Or am I missing something here?

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:35 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/5 "2020-05-16T12:35:50Z")

</div>

I never was that frustrated with using a new tool.

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [16. Mai 2020 um 12:47 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/6 "2020-05-16T12:47:02Z")

</div>

Have you added the domain in the Administration? Shopware needs to know the domain you are calling, otherwhise it will deny your request. Just open the Headless sales channel in the Administration and add the domain you are calling.

&nbsp;

After that start using the Store-API (6.2 only):&nbsp;[https://docs.shopware.com/en/shopware-platform-dev-en/store-api-guide/sales-channel?category=shopware-platform-dev-en/store-api-guide#get-current-context](https://docs.shopware.com/en/shopware-platform-dev-en/store-api-guide/sales-channel?category=shopware-platform-dev-en/store-api-guide#get-current-context)

&nbsp;

or the Storefront api (6.0.0 and newer)

[https://docs.shopware.com/en/shopware-platform-dev-en/sales-channel-api/sales-channel-context-api?category=shopware-platform-dev-en/sales-channel-api](https://docs.shopware.com/en/shopware-platform-dev-en/sales-channel-api/sales-channel-context-api?category=shopware-platform-dev-en/sales-channel-api)

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:52 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/7 "2020-05-16T12:52:34Z")

</div>

Thanks for the answer. Where can I add the Domain? In the main sales channel I can add the domain and there everything is listed. the headless does not have any of this „Domain“ List.

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 12:57 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/8 "2020-05-16T12:57:02Z")

</div>

The Headless Channel only has: General Settings, API Access and Status section in the config of the channel itself. And in the Main channel I also have “Domains” but NOT in the headless

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [16. Mai 2020 um 13:00 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/9 "2020-05-16T13:00:35Z")

</div>

Which version do you use? Ist depends in it.

In general, You can add it&nbsp;to the Storefront as well, every storefront has both api endpoints too. The error above indicates that the domain is unkown to shopware.

In 6.2 you can add a domain to headless sales channels too.

&nbsp;

---

<div class="post-metadata">

**Author:** ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)\
**Post date:** [16. Mai 2020 um 13:11 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/10 "2020-05-16T13:11:51Z")

</div>

You need a valid sw-access-key

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 13:12 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/11 "2020-05-16T13:12:25Z")

</div>

I am using 6.1.5

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 13:15 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/12 "2020-05-16T13:15:45Z")

</div>

I have one Storefront Channela and one Headless.

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 13:16 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/13 "2020-05-16T13:16:23Z")

</div>

The sw-access-key is copied directly from the backend. I tried the sw-access-key from the storefront and the headless sales channel. Both dont work.

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [16. Mai 2020 um 13:23 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/14 "2020-05-16T13:23:55Z")

</div>

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/a/a3c6c0058edd03058e9a2270e510b693062cd65c.png)In my Case its „[http://de.shopwaretest.de/sales-channel-api/v1/context](http://de.shopwaretest.de/sales-channel-api/v1/context)“ and i copied the sw-access-key from the storefront-sales-channel.&nbsp;

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/8/896bc49c3d3e0b58db7a76ed71e3375524eaaeab.png)

&nbsp;

You will get „Not Found“ when requesting the Store-API in a version older than 6.2.0, so make sure you are using the right shopware-version. sales-channel-api should work in both versions (6.1.0 and 6.2.0). „FRAMEWORK\_\_ROUTING\_SALES\_CHANNEL\_NOT\_FOUND“ is an indicator, that the domain is not known to shopware.

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 13:29 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/15 "2020-05-16T13:29:31Z")

</div>

Ok thanks. With the sales channel API it works. I removed now the headless channel because that ones seems senseless. But the problem is still there: How to get the store-api working via this call:&nbsp;

GET http://…/store-api/v1/context

Source:&nbsp;[https://docs.shopware.com/en/shopware-platform-dev-en/store-api-guide/authentication?category=shopware-platform-dev-en/store-api-guide](https://docs.shopware.com/en/shopware-platform-dev-en/store-api-guide/authentication?category=shopware-platform-dev-en/store-api-guide)

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 13:31 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/16 "2020-05-16T13:31:22Z")

</div>

So I will use the API from the storefront. Why do we have then a headless sales channel? Whats the sense of that? Also the channel api is the only one I can access. the others are not working.

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [16. Mai 2020 um 13:32 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/17 "2020-05-16T13:32:49Z")

</div>

> [@edinhobl schrieb:](https://forum.shopware.com/profile/35134/edinhobl "edinhobl")
> 
> So I will use the API from the storefront. Why do we have then a headless sales channel? Whats the sense of that? Also the channel api is the only one I can access. the others are not working.

As I said multiple times before - the store API is only available in the newest version (Release Candidate), It seems that you are using 6.1.x and therefore the headless channel has not domain setup and the store-api is not aivailable.

&nbsp;

---

<div class="post-metadata">

**Author:** ![oliverriske](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@oliverriske](https://forum.shopware.com/u/oliverriske)\
**Post date:** [16. Mai 2020 um 13:33 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/18 "2020-05-16T13:33:11Z")

</div>

Use 6.2 not 6.1.5 as written before.

I do not recomment to delete one of the default saleschannels. Just dont use rhem if you do not need them.

All Apis are working with correct config and handling.

---

<div class="post-metadata">

**Author:** ![edinhobl](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@edinhobl](https://forum.shopware.com/u/edinhobl)\
**Post date:** [16. Mai 2020 um 13:37 UTC](https://forum.shopware.com/t/great-headless-api-useless/66991/19 "2020-05-16T13:37:43Z")

</div>

Ok thanks. I will check how I proceeed with that and if I can setup a custom PWA based on that. I am not sure currently.
