IMD SolutionComputing LibraryShop main store

Explainer

Why PUTHTTP cannot write back: the Flexy tag-update web service

Edge computing and IIoT Published 6 min read By IMD Solution engineering team

Short answer

An external server can change Flexy tag values, but not by reversing PUTHTTP. PUTHTTP is an outbound BASIC call the Flexy makes to your server; the write-back path is the device's inbound web services, which cover reading tags, updating tag values and executing a BASIC script, documented in the vendor's custom web pages material. Build the request from that documentation and prove each write by reading the tag back on the device.

On this page
  1. PUTHTTP is outbound by design
  2. Three inbound services: pick by task
  3. What the request must contain, and where it comes from
  4. Worked verification: write, then read back
  5. The MQTT route when a broker already exists
  6. Network and safety for an inbound write
  7. The decision
  8. Questions asked

Your server can change tag values in an Ewon Flexy, but not by turning PUTHTTP around. PUTHTTP is an outbound BASIC call: the Flexy runs it on its own schedule and pushes data to your server. The reverse direction is a separate inbound interface — the Flexy's web services, which cover reading tags, updating tag values and executing a BASIC script, all documented in the vendor's custom web pages material. This article says which service to call, what the request must contain, and how to prove the value actually changed.

PUTHTTP is outbound by design #

The asymmetry that trips most integrators is this: in your working outbound channel, the Flexy is the HTTP client and your server is the listener. PUTHTTP lives inside a BASIC script on the device; the device decides when to call it, formats the body and sends it. Nothing on the Flexy waits for a PUTHTTP-shaped request to arrive, so there is no URL on the device you can POST a PUTHTTP body to. A server cannot "call PUTHTTP at" a Flexy any more than it can answer a connection that was never made to it.

Your outbound channel still proves something useful: the network path between the two endpoints works in one direction. When that outbound call itself misbehaves, the request errors in Flexy BASIC scripts have their own diagnosis, covered in resolving Flexy HTTP request errors in BASIC scripts. And if you are still deciding how the two systems should talk in both directions overall, choosing a data transport from Flexy to a custom SCADA lays out the outbound options this write-back path will sit next to.

Three inbound services: pick by task #

The Flexy's inbound web-service interface offers three operations relevant here. The decision is purely by task:

Your task Service to call Why
Read current tag values The tag-reading service Returns values without touching them
Change a tag's value The tag-update service The only service that writes a value
Run device-side logic The script-execution service Executes a BASIC script; use it when the write needs computation or sequencing on the device, not for a plain value change

For the question at hand — the server modifying tag values — the answer is the tag-update service, full stop. Reach for the script-execution service only when the value must be derived on the device, for example a setpoint that has to be clamped or combined with other tags before it lands. Do not use script execution as a workaround for not knowing the update request format; it adds a script to maintain for no benefit.

What the request must contain, and where it comes from #

An inbound tag-update request has six defined parts, and every one of them comes from the vendor's custom web pages documentation for these web services:

  • The endpoint address of the tag-update service on the device.
  • The HTTP method that service expects.
  • The authentication the device requires before it accepts the call.
  • The field that identifies which tag to write.
  • The encoding of the value itself.
  • The success and error responses the device returns.

Take all six from that documentation, not from a forum snippet or from the shape of your outbound PUTHTTP body. The two interfaces are unrelated, and a request built by analogy will do the worst possible thing: connect successfully, return a plausible status, and change nothing — because the tag identifier field or value encoding is wrong. The documentation is the specification here; code against it directly.

One distinction worth keeping straight: the update service changes the value of a tag that already exists. Creating or reworking large numbers of tag definitions is a different job, and the vendor documents separate alternatives to editing tags one by one in the device's web interface. Do not try to script tag creation through value updates.

Worked verification: write, then read back #

A success response proves the Flexy answered the request. It does not prove the stored value changed. Make the read-back part of the procedure:

  1. Pick a controlled test tag — an integer tag nothing else writes.
  2. Send the tag-update request setting it to a known example value, say 1250 (a counter preset in this example).
  3. Record the full HTTP response, status and body.
  4. Read the same tag back through the tag-reading service.
  5. Compare written and read values.

The arithmetic is deliberately unforgiving. Written value 1250, read value 1250:

  • Difference: 1250 − 1250 = 0. For an integer tag the pass condition is a difference of exactly 0. Pass.

If the read returns the tag's untouched default, say 0:

  • Difference: 0 − 1250 = −1250. Fail, even if the HTTP response said success. A nonzero difference with a success status points at the tag identifier field or the value encoding, so compare those two parts of your request against the documentation first.

If the tag you must write is also refreshed from the PLC between your write and your read, read back immediately, or the poll cycle will overwrite your value and masquerade as a failed write.

The MQTT route when a broker already exists #

The web services are not the only write-back path. If your plant already runs an MQTT broker, the reverse direction can be a subscription: your server publishes the new value to a topic, and a BASIC script on the Flexy subscribes and writes it into the tag — the pattern detailed in subscribe to MQTT and write the value back to the PLC.

Choose between the two by traffic shape. For on-demand commands — a preset changed a few times a shift, where the server wants a response per request — use the tag-update web service; it is request-and-reply, and the reply tells you immediately whether the device accepted the call. For a continuous stream of values, the MQTT subscription wins: one persistent connection carries every update, and the server never needs to reach the device's web interface directly.

Network and safety for an inbound write #

The outbound channel you already have does not open the inbound path. For the web-service route, the server must be able to initiate connections to the Flexy, which means a firewall rule permitting that direction and the authentication the device's documentation specifies; carry the same care into TLS that you would on any OT-exposed service. For the MQTT route, the direction reverses — the Flexy dials the broker — which is often easier through a firewall, since it matches the pattern your outbound channel already uses.

One safety point, stated once: a tag write that lands on a tag mapped to a running machine acts on that machine. Do the first writes against a spare tag, and only point the production request at a live tag once the read-back check passes.

The decision #

  • Server sets tag values on demand: use the tag-update web service. Take the endpoint, method, authentication, tag identifier field, value encoding and response codes from the vendor's custom web pages documentation — nowhere else.
  • Server needs device-side computation before the write: use the script-execution service with a BASIC script that performs the clamping or sequencing, then verify the resulting tag the same way.
  • A broker is already in place and the writes are a continuous stream: use the MQTT subscribe route instead.
  • PUTHTTP: leave it exactly as it is. It is your outbound channel and it stays outbound. The proof that any write-back works is not the HTTP status but the read-back: written value minus read value equals zero, every time.

Questions asked

Can an external server update tag values in an Ewon Flexy?

Yes. The Flexy exposes inbound web services that an external system can call, including one that updates tag values. The request format, authentication and response behavior are defined in the vendor's custom web pages documentation, and that documentation is the only correct source for the endpoint and method.

Is there a way to reverse the PUTHTTP request so the server writes into the Flexy?

No. PUTHTTP is a BASIC function the Flexy's script calls on its own schedule, and the server only receives it. The Flexy has no listener that accepts a reversed PUTHTTP. The server-to-Flexy direction is a separate inbound web-service interface, so a working outbound channel proves connectivity, nothing more.

Do I need an MQTT broker to write values back into the Flexy?

No. The tag-update web service works with plain HTTP requests and needs no broker. MQTT becomes attractive only when your plant already runs a broker: the server publishes to a topic and a BASIC script on the Flexy subscribes and writes the value into a tag, which suits continuous streams better than one-shot commands.

Does a successful HTTP response prove the tag value changed?

No. A success status proves the Flexy accepted and answered the request; the stored value can still differ because the tag identifier or value encoding in the request was wrong. Read the tag back through the tag-reading service or on the device, and require an exact match for an integer tag before calling the write done.

Can I use the web services to import hundreds of tag definitions at once?

Runtime value writes and tag-definition edits are different jobs. The update web service changes values of tags that already exist. For creating or reworking large numbers of tag definitions, the vendor documents alternatives to editing tags one by one in the web interface; use those instead of scripting value updates.

Keep reading

  • Troubleshooting

    Trace Ignition Edge MQTT values that only update on refresh

    Values that appear only after a refresh mean the Edge transmitter publishes nothing on its own: the forced republish masks a stalled change-driven path. Set a 10,000 ms scan rate with a 0.00000001 deadband and a moving signal publishes at the scan rate, then verify by counting 6 updates per minute with no refresh anywhere. Trace tag value and timestamp at each hop to find where it stops.

    Edge computing and IIoT

  • How-to

    Checking MQTT connection status in an Ewon Flexy BASIC script

    On an Ewon Flexy with firmware 14.x or later, a BASIC script reads the MQTT link state with the MQTT Status command: a returned 5 means the connection is operational and any other value means it is not. The firmware owns disconnection and reconnection, so the script only monitors and logs, and you investigate the internet path when the broker never comes back on its own.

    Edge computing and IIoT

  • How-to

    Send Flexy tag values to MindSphere over MQTT every 10 seconds

    Open one MQTT session from the Flexy init section to the MindSphere MCIoT Extension broker on port 1883 with keepalive 30 and CleanSession 1, publish the three registration payloads on s/us, then register Ontimer 1 once and schedule it with Tset 1,10 so a single type-200 payload with both tag records goes out every 10 seconds. The timer registration belongs in the init section, not the cyclic one.

    Edge computing and IIoT

Using flat files as the Ignition tag historian back end