HTML example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
(async () => {
const pixera = "192.168.56.1:1234";
const command =
'{"jsonrpc":"2.0", "id":21, "method":"Pixera.Utility.getApiRevision", "params":{}}';
const request = await fetch("http://" + pixera, {
method: "POST",
body: command,
});
const text = await request.text();
alert(text);
})();
</script>
</body>
</html>
Typescript example:
const text = await(
await fetch("http://192.168.56.1:1234", {
method: "POST",
body: '{"jsonrpc":"2.0", "id":21, "method":"Pixera.Utility.getApiRevision", "params":{}}',
})
).text();