doJSONPostRequest

open fun doJSONPostRequest(uri: URI): JSONObject

Performs an HTTP POST request assuming that the response body will contain a valid JSON document. The JSON document is parsed and returned as a JSONObject.

Return

a JSONObject created by parsing the HTTP response, or null if the response is empty

Parameters

uri

the request URI

Throws

org.json.JSONException

open fun doJSONPostRequest(uri: URI, headers: Map<String, String>): JSONObject

Performs an HTTP POST request assuming that the response body will contain a valid JSON document. The JSON document is parsed and returned as a JSONObject.

Return

a JSONObject created by parsing the HTTP response, or null if the response is empty

Parameters

uri

the request URI

headers

the request headers

Throws

org.json.JSONException

open fun doJSONPostRequest(uri: URI, headers: Map<String, String>, requestBody: String): JSONObject