Write variables with REST (PUT)

Hello, I’m working with the HTML5 REST example and it works fine. I can read and change the variables via REST. For example, the variable “Integer1”. But if I want to create a new custom variable, I can only read it (GET). A write with PUT does not work. The variable is declared as EXTERNAL. Even renaming an already existing variable means that I can only read it. For example the variable “Integer1” to “Flag1”. Do I need to declare or set the variables for REST anywhere else? Thank you for your help. Greetings Daniel

Hey Waschto,

what exactly are you sending and what is the response?
Can you check with your browsers dev-tools / Networkinspector?

Is the variable beeing written with the IEC Program as well? kind regards, Oliver

Hello Oliver, i use Postman. The Debug-Output is the same for booth request - PUT my own variable (Flag1) and PUT the existing (Integer1) variable. For testing i changed the type from the variable Integer1 to bool. It works fine. In addition, i have deleted all programs and additional variables (Integer2, Array1 …). Neither variable is now used in programs. I only create a main-Prgramm with the two variables and add it to the ESM1. They are defined as external. Here the debug-output: For PUT Flag1 PUT /_pxc_api/api/variables/ Content-Type: application/json User-Agent: PostmanRuntime/7.15.2 Accept: / Cache-Control: no-cache Postman-Token: 30aae2de-5765-43dd-a253-618dfe1d5ae7 Host: 192.168.103.2 Accept-Encoding: gzip, deflate Content-Length: 108 Connection: keep-alive {“pathPrefix”: “Arp.Plc.Eclr/”, “variables”: [ { “path”: “Flag1”, “value”: 421, “valueType”: “Constant” } ]} HTTP/1.1 200 status: 200 Server: nginx/1.15.2 Date: Thu, 22 Aug 2019 09:43:59 GMT Content-Type: application/json Content-Length: 187 Connection: keep-alive Status: 200 OK Cache-Control: no-cache {“apiVersion”:“1.1.0.3”,“projectCRC”:3738360288,“userAuthenticationRequired”:true,“variables”:[{“path”:“Arp.Plc.Eclr/Flag1”,“value”:2,“uri”:“/_pxc_api/api/variables/Arp.Plc.Eclr/Flag1”}]} As response i get only the old value of Flag1 → 2 and the variable is not set to the new value. PUT Integer1 PUT /_pxc_api/api/variables/ Content-Type: application/json User-Agent: PostmanRuntime/7.15.2 Accept: / Cache-Control: no-cache Postman-Token: 4d6dbcdd-d448-405d-8613-e17ff48b1b1e Host: 192.168.103.2 Accept-Encoding: gzip, deflate Content-Length: 112 Connection: keep-alive {“pathPrefix”: “Arp.Plc.Eclr/”, “variables”: [ { “path”: “Integer1”, “value”: true, “valueType”: “Constant” } ]} HTTP/1.1 200 status: 200 Server: nginx/1.15.2 Date: Thu, 22 Aug 2019 09:45:21 GMT Content-Type: application/json Content-Length: 196 Connection: keep-alive Status: 200 OK Cache-Control: no-cache {“apiVersion”:“1.1.0.3”,“projectCRC”:3738360288,“userAuthenticationRequired”:true,“variables”:[{“path”:“Arp.Plc.Eclr/Integer1”,“value”:true,“uri”:“/_pxc_api/api/variables/Arp.Plc.Eclr/Integer1”}]} Here i get the new value (true) as response and the variable is also set to the new value. Greetings Daniel