Methods
Most of the following methods return either a Response object, or a Promise object that will eventually resolve to a Response object, if asynchronous. Asynchronous means that the method will be called, but will not block script execution - so multiple asynchronous calls to network services can be made in succession, without each call "waiting" for the result of the previous. Parameters for these functions are documented below.
Method | Description | Return type |
---|
.get() | Sends an HTTP GET call, blocking for a response. | Response |
.getAsync() | Sends an HTTP GET call without blocking. | Promise |
.post() | Sends an HTTP POST call, blocking for a response. | Response |
.postAsync() | Sends an HTTP POST call without blocking. | Promise |
.put() | Sends an HTTP PUT call, blocking for a response. | Response |
.putAsync() | Sends an HTTP PUT call without blocking. | Promise |
.delete() | Sends an HTTP DELETE call, blocking for a response. | Response |
.deleteAsync() | Sends an HTTP DELETE call without blocking. | Promise |
.patch() | Sends an HTTP PATCH call, blocking for a response. | Response |
.patchAsync() | Sends an HTTP PATCH call without blocking. | Promise |
.head() | Sends an HTTP HEAD call, blocking for a response. | Response |
.headAsync() | Sends an HTTP HEAD call without blocking. | Promise |
.options() | Sends an HTTP OPTIONS call, blocking for a response. | Response |
.optionsAsync() | Sends an HTTP OPTIONS call without blocking. | Promise |
.trace() | Sends an HTTP TRACE call, blocking for a response. | Response |
.traceAsync() | Sends an HTTP TRACE call, without blocking for a response. | Promise |
.request() | Sends an HTTP request, using a verb specified by the method parameter. Use this method in cases where a non-standard verb is required, and you need the call to block. | Response |
.requestAsync() | Sends an HTTP request, with a verb specified by the method parameter. Use this method in cases where a non-standard verb is required, and you do not want the call to block. | Promise |
.setGson() |
The following feature is new in Ignition version 8.1.10
Click here to check out the other new features
Used to override the JSON serialization behavior on the client instance. Expects a single argument, which is a configured Gson instance. In most cases this method is unnecessary, but it can be useful in cases where the default serialization casts values in an unwanted way. To learn more, see GsonBuilder.
from com.inductiveautomation.ignition.common.gson import GsonBuilder
# Create the client instance
client = system.net.httpClient()
# Create a new
altGson = GsonBuilder().serializeNulls().create()
client.setGson(altGson)
| None |
Parameters
Parameters in this section can be used by any of the methods above. Exceptions to this rule will be defined on each parameter.