Class Response
java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.http.Response
The result of an HTTP request.
Provides access to status codes, headers, and body content. In Python, this object's
properties (e.g., status, body, json, text) can be accessed
directly.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getBody()HttpResponse<byte[]>org.python.core.PyObjectgetJson()@NonNull org.python.core.PyObjectAttempt to decode the rawbyte[]this Response contains to a string with the specified charset, and then decode that string to a direct Python representation (ie, dictionaries and lists).intgetText()@NonNull StringAttempt to decode the rawbyte[]this Response contains to a string with the specified charset.getUrl()booleanbooleanisGood()booleantoString()
-
Constructor Details
-
Response
-
-
Method Details
-
getBody
public byte[] getBody()- Returns:
- The raw byte array of the response body. Accessible as
bodyin Python.
-
getJson
public org.python.core.PyObject getJson()- Returns:
- The response body decoded as a
PyObject(e.g., dictionary or list). Accessible asjsonin Python.
-
getJson
Attempt to decode the rawbyte[]this Response contains to a string with the specified charset, and then decode that string to a direct Python representation (ie, dictionaries and lists). Encoding defaults to the charset specified in the response, orStandardCharsets.UTF_8if the response did not specify a charset. -
getText
- Returns:
- The response body as a string. Accessible as
textin Python.
-
getText
Attempt to decode the rawbyte[]this Response contains to a string with the specified charset. Caches decoded bodies so they can be quickly retrieved again, per charset. Encoding defaults to the charset specified in the response, orStandardCharsets.UTF_8if the response did not specify a charset. -
getUrl
-
getHeaders
-
getStatusCode
public int getStatusCode()- Returns:
- The HTTP status code (e.g., 200, 404). Accessible as
statusCodein Python.
-
isGood
public boolean isGood()- Returns:
- true if the response code was not any error.
-
isClientError
public boolean isClientError()- Returns:
- true if the response code was a 4XX error.
-
isServerError
public boolean isServerError()- Returns:
- true if the response code was a 5XX error.
-
getCookieManager
-
getJavaResponse
-
getRequest
-
toString
-