I am trying to do an API request to the VRM but getting 401 return.
When I do the login request I get the user id and authorisation code. I have put this in a HTTP JSON request as shown below but not getting any data back. Can someone please help point me in the write direction.
<html>
<head>
<?php
header('X-Authorization: Token {...}');
?>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
getData();
};
function getData() {
$.ajax({
url: "https://vrmapi.victronenergy.com/v2/users/57713/installations",
type: "GET",
success: function (data) {
console.log(data);
}
});
}
</scrip
</head>
<body>
<h1>Victron</h1>
</body>
</html>