Ich versuche Shopware Api über Postman aufzurufen,leider erfolglos
-
Ich habe den
- shopware version 6.4.11.1
- Access-key-id : Idxxxxxxxxxxxxxxxx
- access-key-secret : Keyxxxxxxxxxxx
-
Im Postman habe ich
* base url : https://my-shopware-seite.de/api/oauth/token
* request POST
* Authorization api-key gewählt und
api-key : access-key-id (Idxxxxxxxxxxxxxxxxxxxxxxx)
value: access-key-secret (Keyxxxxxxxxxxxxxxxxxxxxxx)
angegen.
Es klappt nicht . Mache ich überhaupt richtig? Wenn nicht, könnt Ihr bitte schreiben wie es geht?
vielen Dank im Voraus.
-
I also tried with xml request it did not work.
<html>
<head>
<title> testing </title>
</head>
<body>
<script>
const data = JSON.stringify({
"client_id": "administration",
"grant_type": "password",
"scopes": "write",
"username": "my-username",
"password": "my-password"
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://my-shopware-site.de/api/auth/token");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.send(data);
//console.log("test");
</script>
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json', Accept: 'application/json'},
body: '{"client_id":"administration","grant_type":"password","scopes":"write","username":"your.username@shopware.com","password":"your.password@123"}'
};
fetch('http://localhost/api/auth/token', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));