Trillo Java SDK
Search
K

HttpApi (HTTP APIs)

get

Retrieve​ a json result using HTTP get.
HttpApi.get(String requestUrl)
or
HttpApi.get(String requestUrl, Map<String, String> headers)
Parameters
requestUrl: requested url
headers
Returns
result of the operation​

post

HTTP Post with the body and optionally headers and retrieve returning object.
HttpApi.post(String requestUrl, Map<String, Object> body)
or
HttpApi.post(String requestUrl, Map<String, Object> body, Map<String, String> headers)
or
HttpApi.postAsString(String requestUrl, Object body)
or
HttpApi.postAsString(String requestUrl, Object body, Map<String, String> headers)
Parameters
requestUrl: requested URL
body: body of the request
headers: headers
Returns
the result of the operation​

put

Execute​ HTTP put with a given body and a header to the requested URL.
HttpApi.put(String requestUrl, Map<String, Object> body)
or
HttpApi.put(String requestUrl, Map<String, Object> body, Map<String, String> headers)
Parameters
requestUrl: requested url
body: payload
headers: headers
Returns
result of the operation​

patch

Execute HTTP patch​ with the requested body and header to a URL.
HttpApi.patch(String requestUrl, Map<String, Object> body)
or
HttpApi.patch(String requestUrl, Map<String, Object> body, Map<String, String> headers)
Parameters
requestUrl: requested url
body: payload
headers: headers
Returns
the result of the operation​

delete

Execute HTTP delete with a body and a header to a requested URL.
HttpApi.delete(String requestUrl, Map<String, Object> body)
or
HttpApi.delete(String requestUrl, Map<String, Object> body, Map<String, String> headers)
Parameters
requestUrl: requested url
body: body of the request
headers: headers
Returns
the result of the operation​

getAsString

Description...
HttpApi.getAsString(String requestUrl)
or
HttpApi.getAsString(String requestUrl,
Map<String, String> headers)

Parameters

requestUrl
headers

Returns

// Some code

postAsString

Description...
HttpApi.postAsString(String requestUrl, Object body)
or
HttpApi.postAsString(String requestUrl, Object body,
Map<String, String> headers)

Parameters

requestUrl
body
headers

Returns

// Some code

putAsString

Description...
HttpApi.putAsString(String requestUrl, Object body)
or
HttpApi.putAsString(String requestUrl, Object body,
Map<String, String> headers)

Parameters

requestUrl
body
headers

Returns

// Some code

patchAsString

Description...
HttpApi.patchAsString(String requestUrl, Object body)
or
HttpApi.patchAsString(String requestUrl, Object body,
Map<String, String> headers)

Parameters

requestUrl
body
headers

Returns

// Some code

deleteAsString

Description...
HttpApi.deleteAsString(String requestUrl, Object body)
or
HttpApi.deleteAsString(String requestUrl, Object body,
Map<String, String> headers)

Parameters

requestUrl
body
headers

Returns

// Some code

readFileAsJSON

Description...
HttpApi.readFileAsJSON(String url,
Map<String, String> headerMap)
or
HttpApi.readFileAsJSON(String url, Charset encoding, Map<String,
String> headerMap)

Parameters

url
headerMap
encoding

Returns

// Some code

readFileAsString

Description...
HttpApi.readFileAsString(String url, Map<String,
String> headerMap)
or
HttpApi.readFileAsString(String url, Charset encoding,
Map<String, String> headerMap)

Parameters

url
headerMap
encoding

Returns

// Some code

readFileAsBytes

Description...
HttpApi.readFileAsBytes(String url,
Map<String, String> headerMap)

Parameters

url
headerMap

Returns

// Some code

writeFile

Description...
HttpApi.writeFile(String url, String filePath, String fileFieldName,
Map<String, String> headerMap)
or
HttpApi.writeFile(String url, String filePath, String fileFieldName,
Map<String, String> headerMap,
Map<String, Object> additionalFields)

Parameters

url
filePath
fileFieldName
headerMap
additionalFields

Returns

// Some code

writeFileBytes

Description...
HttpApi.writeFileBytes(String url,String fileName,
byte[] fileContent, String fileFieldName,
Map<String, String> headerMap)
or
HttpApi.writeFileBytes(String url,String fileName, byte[] fileContent,
String fileFieldName, Map<String, String> headerMap,
Map<String, Object> additionalFields)
or
HttpApi.writeFileBytes(String url, String fileName,
String fileContentAsString, String fileFieldName, Map<String,
String> headerMap)
or
HttpApi.writeFileBytes(String url, String fileName, String fileContentAsString,
String fileFieldName, Map<String, String> headerMap, Map<String,
Object> additionalFields)

Parameters

url
fileName
fileContent
fileFieldName
headerMap
additionalFields
fileContentAsString

Returns

// Some code