Siemens SIMATIC S7-1500 Function Manual page 189

Web server
Hide thumbs Also See for SIMATIC S7-1500:
Table of Contents

Advertisement

Web pages
3.20 API (Application Programming Interface)
api.js
"use-strict"
let messageId = 1
let TARGET_IP = "https://192.168.2.132/api/jsonrpc"
let AUTH_TOKEN = null
function ping() {
if (AUTH_TOKEN !== null) {
}
}
setInterval(ping, 50000)
function updateTurbineSpeed() {
if (AUTH_TOKEN !== null) {
}
}
188
fetch(TARGET_IP, {
method: "POST",
headers: {
"Content-type": "application/json",
"X-Auth-Token": AUTH_TOKEN
},
body: JSON.stringify({
"id": messageId++,
"jsonrpc": "2.0",
"method": "Api.Ping"
})
})
fetch(TARGET_IP, {
method: "POST",
headers: {
"Content-type": "application/json",
"X-Auth-Token": AUTH_TOKEN
},
body: JSON.stringify({
"id": messageId++,
"jsonrpc": "2.0",
"method": "PlcProgram.Read",
"params": {
"var": "\"turbine_speed\""
}
})
})
.then(response => response.json())
.then((data) => {
let turbNum = document.getElementById("turb-speed")
turbNum.value = data.result
})
.catch(e => console.error(e))
Function Manual, 11/2019, A5E03484625-AG
Web server

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic et 200proSimatic et 200sp

Table of Contents