Step 1 - OMF message headers
- Last UpdatedSep 04, 2025
- 1 minute read
The OMF specification breaks communication between the client and server into two parts: the message headers, and the message body. The message headers tell the server how the message body should be interpreted. When communicating over HTTP, the HTTP request headers are treated as the message headers, and the HTTP request content is treated as the message body.
The OMF application formats the message body as a JSON array of objects. To achieve better performance, you can optionally compress the message body using gzip compression, but our OMF application will ignore this feature for now.
The HTTP requests that our application sends will need to include these OMF message headers:
-
omfversion
This header tells the server what version of the OMF specification the request should use. For our application, we will use version 1.2 of the OMF specification, so the value should be 1.2.
-
messagetype
This header tells the server what information is contained in the message body. This header may contain one of the three values:
-
type
-
container
-
data
The value we include will vary between requests. Normally, an OMF application will start by sending a type request.
-
-
messageformat
This header tells the server what format the message body is using. For our OMF application, we will use the value json.
-
X-Requested-With
This header is used by the PI Web API to enforce the Cross-Site Request Forgery defense mechanism. Although this header isn't part of the OMF specification, our application should include it. The value of this header can be any non-empty string; a common value used by web applications is XMLHttpRequest.