I set up a GET Request with the URL in Postman and added as header the 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:
Sometimes I get: {“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:
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.
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.
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
In general, You can add it 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.
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.
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:
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.
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.