Api - Wincc Rest
<RestApi> <Port>50051</Port> <EnableHttps>true</EnableHttps> <CertificateThumbprint>AB123...</CertificateThumbprint> <CorsOrigins> <Origin>https://dashboard.company.com</Origin> </CorsOrigins> <MaxTagReadBatch>100</MaxTagReadBatch> </RestApi> Base URL: https://<wincc-ip>:50051/api/v1
"success": true, "timestamp": "2025-03-15T14:32:10Z", "results": "TankLevel": "value": 75.5, "quality": "good"
5.1 Python Client (using requests with NTLM auth) import requests from requests_ntlm import HttpNtlmAuth BASE_URL = "https://wincc-prod01:50051/api/v1" auth = HttpNtlmAuth("DOMAIN\wincc_user", "password") Read multiple tags payload = "tags": ["Temperature", "Pressure", "FlowRate"] resp = requests.post(f"BASE_URL/tags/read", json=payload, auth=auth, verify=False) print(resp.json()) Write to tag write_payload = "Setpoint": 120.0 resp = requests.post(f"BASE_URL/tags/write", json=write_payload, auth=auth) 5.2 JavaScript (Browser / Node.js with fetch) // Browser (requires CORS and Windows auth via credential inclusion) const response = await fetch('https://wincc-server:50051/api/v1/tags/read', method: 'POST', credentials: 'include', headers: 'Content-Type': 'application/json' , body: JSON.stringify( tags: ['ConveyorSpeed', 'Power'] ) ); const data = await response.json(); console.log(data); 5.3 C# .NET Client using var client = new HttpClient(new HttpClientHandler UseDefaultCredentials = true ); client.BaseAddress = new Uri("https://wincc-server:50051/api/v1/"); var content = new StringContent("\"tags\":[\"Level\"]", Encoding.UTF8, "application/json"); var response = await client.PostAsync("tags/read", content); var json = await response.Content.ReadAsStringAsync(); 6. Practical Use Cases 6.1 Real-Time Dashboard (React + Chart.js) A web dashboard displaying live production metrics (OEE, temperature, pressure) updated every 2 seconds via setInterval polling to the REST API. 6.2 Integration with MES / ERP A Python script reads hourly production counts from WinCC tags via REST and writes them to a SQL Server database or SAP via RFC. 6.3 Mobile Alerting (Twilio + WinCC Alarms) A Node.js service monitors /alarms/active every 5 seconds. When a critical alarm appears, it sends an SMS using Twilio API. 6.4 Historical Analysis (Pandas / Jupyter) Data scientists pull archive data over a date range and analyze machine performance using Python’s Pandas. 7. Performance and Limitations | Aspect | Observation | |--------|--------------| | Latency | ~20–50 ms per single tag read (LAN) | | Throughput | ~300–500 requests/second (batch of 50 tags) | | Max batch size | 200 tags per request (configurable) | | Historical data | Up to 10,000 samples per request | | Concurrent clients | Tested up to 20 without degradation | | Limitation | No WebSocket or server-sent events – only polling | wincc rest api
Abstract As industrial environments transition toward Industry 4.0 and IIoT, traditional Human-Machine Interface (HMI) systems like Siemens WinCC must expose data via modern, platform-agnostic interfaces. This paper explores the WinCC REST API – its architecture, setup, authentication methods, endpoint structure, and practical use cases. We provide implementation examples in Python and JavaScript, discuss performance considerations, and compare the REST API with OPC UA and native WinCC interfaces. Finally, we examine security implications and future developments. 1. Introduction WinCC (Windows Control Center) by Siemens is a leading SCADA and HMI system used in manufacturing, energy, and infrastructure. Historically, data access relied on OPC (Classic/UA), proprietary DLLs (e.g., CCApi ), or database queries. However, modern web-based dashboards, mobile applications, and enterprise IT systems require stateless, HTTP-based communication.
:
| Method | Endpoint | Description | |--------|------------------------------|-------------------------------------------| | GET | /tags | List all tags (paginated) | | GET | /tags/<name> | Read single tag value | | POST | /tags/read | Batch read multiple tags | | POST | /tags/write | Write one or more tags | | GET | /alarms/active | Get current active alarms | | GET | /alarms/history | Query alarm log (with filters) | | POST | /alarms/acknowledge | Acknowledge an alarm by ID | | GET | /archives/<tag>/values | Historical values over time range | | GET | /status | WinCC runtime status (running/stopped) | Request (Write tag TankLevel to 75.5):
POST /api/v1/tags/write Host: wincc-server:50051 Content-Type: application/json Authorization: Negotiate ... "TankLevel": 75.5 and infrastructure. Historically
$cred = Get-Credential $body = @tags=@("Tag1","Tag2") | ConvertTo-Json Invoke-RestMethod -Uri "https://wincc:50051/api/v1/tags/read" -Method Post -Body $body -Credential $cred -ContentType "application/json"
The (available in WinCC Professional V7.5 SP2 and later, as well as WinCC OA) provides a RESTful interface to read/write process tags, acknowledge alarms, and retrieve archive data. This paper documents its capabilities and practical integration. 2. Architecture Overview The WinCC REST API is implemented as an additional service running on the WinCC station. It communicates with the WinCC Runtime Database via internal COM interfaces. data access relied on OPC (Classic/UA)