REST interface variables : questions / remarks

I am looking at the documentation of the REST Data Interface and have a couple of questions / remarks (https://www.plcnext.help/te/Service_Components/REST_data_interface/REST_data_interface_Introduction.htm) I just want to use curl for now to get a basic understanding on how the API is structured without resorting to JS frameworks. I also disabled authentication (see my other post on Oauth2 compliance of the API). The section on “REST data interface - Variables” seems pretty confusing as it doesn’t really explain what endpoint to use, what query param it supports … Instead the doc states that "This is done via the following HTTP GET command: GET [https://%plcaddress%>](https://%plcaddress%</code)" but does not mention the path it should use As per my understanding To update a variable you send the following PUT request to https://192.168.0.10/_pxc_api/v1.1/variables/

{
"pathPrefix":"Arp.Plc.Eclr/",
"variables":[
{
"path":"Boolean2",
"value":"true",
"valueType":"Constant"
}
]
}

Using cURL :   
>   
> curl -vk -X PUT -d "{\"pathPrefix\": \"Arp.Plc.Eclr/\", \"variables\": [ { \"path\": \"Boolean2\", \"value\": \"false\", \"valueType\": \"Constant\" } ] }" <https://192.168.0.10/_pxc_api/v1.1/variables/>  
>   
> 

To read the variable I can do a POST like this :

curl -vk -X POST -d "pathPrefix=Arp.Plc.Eclr/&paths;=Boolean2" <https://192.168.0.10/_pxc_api/v1.1/variables/ | jq>[  
> ](https://192.168.0.10/_pxc_api/v1.1/variables/ | jq)

and that seems to work returning this : **{** ******"apiVersion"****:** "1.2.0.0"**,** ******"projectCRC"****:** 4144859874**,** ******"userAuthenticationRequired"****:** true**,** ******"variables"****: [** **{** ******"path"****:** "Arp.Plc.Eclr/Boolean2"**,** ******"value"****:** true **}** **]** **}** But I cannot get this to work with query params (using POST to read variables seems counter-intuitive and not really in-line with REST standards. Because with a GET request curl -vk https://192.168.0.10/_pxc_api/v1.1/variables?paths=Boolean2 I get this (value is always null but should be true or false { “apiVersion”: “1.2.0.0”, “projectCRC”: 4144859874**,** “userAuthenticationRequired”: true**,** “variables”: [ { “path”: “Boolean2”, “value”: null } ] } If I add the pathPrefix querystring (I encoded the slash as I don’t think this is a valid character in a querystring) I curl -vk [https://192.168.0.10/_pxc_api/v1.1/variables?pathPrefix=Arp.Plc.Eclr%2F&paths;=Boolean2](https://192.168.0.10/_pxc_api/v1.1/variables?pathPrefix=Arp.Plc.Eclr%2F&paths=Boolean) get a bad request : {"apiVersion":"1.2.0.0","projectCRC":4144859874,"error":{"code":400,"details":[{"domain":"groups","reason":"missingPaths"}]}} Are there other examples available somewhere that provide some real world examples on how to use this API from an external client ?

Hello, I suppose you already disabled Authentication in the WebServer setting (from PLCNext Engineering) as showed in the guideline. If so, please just include your URL request between double quote. I attach a brief example, in my case it’s working.