Use GraphQL in WinCC OA …

This is a simple example how to query a GraphQL server from WinCC OA ctrl via HTTP.

{
  string url = "https://server.rocworks.at/graphql";

  string query = "query($tag: String!){getTag(name: $tag){tag{current{value}}}}";

  mapping variables = makeMapping("tag", "Input");

  mapping content = makeMapping("query", query, "variables", variables);

  mapping data = makeMapping(
      "headers", makeMapping("Content-Type", "application/json"),
      "content", jsonEncode(content)
  );

  mapping result;

  netPost(url, data, result);

  if (result["httpStatusText"]=="OK") {
    DebugTN(result["content"]);
  }
  else {
    return "Error";
  }
}

Output:

{
   "data": {
     "getTag": {
       "tag": {
         "current": {
           "value": 280.87696028711866
         }
       }
     }
   }
 }