We're using Bearer authentication (also called token authentication) which is an HTTP authentication scheme that involves security tokens called bearer tokens. The client must send this token in the Authorization header when making requests to protected resources:
Authorization: Bearer <token>
β
Example in curl:
β
curl -X POST \
--data "@/path/to/filename" \
-H "Authorization: Bearer <token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"https://open-api.durchsichtig.xyz/12.2022/orders/validate"
Example in TypeScirpt
β
fetch('https://open-api.durchsichtig.xyz/12.2022/orders/validate', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: [...]
});
Good to know: In order to generate a token for the Klar API or Klar Returns you have to connect a data source of the type "Klar Api" or ""Klar Returns" first.
This can be achieved by navigating to Settings > Store Configurator > Your Store > Data Sources and clicking on Connect Data Source. In the appearing modal, please select Klar Api / Klar Returns and give your data source a name, e.g. Order API.
β
Klar API data source in Connect Data Source modal
Klar Returns data source in Connect Data Source modal
Once the data source has been created, you can navigate to the tab Access Token and click the button Copy Token.
The token should look like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhU291cmNlSWQiOiIkS0lEOkFHR19JRDoxYmEyYWY4OC0zODZiLTQyZjQtODE2Ni04NDVjNjc4NTEwOWE
6ZGYzOTc2MzAtYTdjOC00ODI3LWJhNjUtN2U0N2FjOGRjNmM5OiQiLCJ0eXBlIjoia2xhci1pbXBvcnQtYXBpIiwidmVyc2lvbiI6MCwiaWF0IjoxNjc2ODg0Mjg4
LCJhdWQiOiJrbGFyLWltcG9ydC1hcGkiLCJpc3MiOiJrbGFyIiwic3ViIjoiJEtJRDpBR0dfSUQ6MWJhMmFmODgtMzg2Yi00MmY0LTgxNjYtODQ1YzY3ODUxMDlhOm
RmMzk3NjMwLWE3YzgtNDgyNy1iYTY1LTdlNDdhYzhkYzZjOTokIn0.dPsPZ8RoCPikjNJFc_4FBfhaqN0a9Won19Rj4puz6c8