> For the complete documentation index, see [llms.txt](https://trillo.gitbook.io/trillo-workbench-python-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trillo.gitbook.io/trillo-workbench-python-sdk/http-methods.md).

# HttpApi (HTTP APIs)

## get

Retrieve​ a json result using HTTP get.&#x20;

```
HttpApi.get(requestUrl) 
or
HttpApi.get(requestUrl, headers)
or
HttpApi.get(requestUrl, headers, retryCount, waitTime)
or 
HttpApi.getWithRetry(requestUrl, headers)
```

**Parameters**

```
requestUrl (string)
headers (dictionary)
retryCount (int)
waitTime (int)
```

**Returns**

```
The response object from the GET request.
```

## post

HTTP Post with the body and optionally headers and retrieve returning object.

```
HttpApi.post(requestUrl, body)
or
HttpApi.post(requestUrl, body, headers)
or
HttpApi.postAsString(requestUrl, body)
or
HttpApi.postAsString(requestUrl, body, headers) 
or
HttpApi.postFormData(requestUrl, body, headers)
or
HttpApi.postFormDataAsString(requestUrl, body, headers)
or
HttpApi.postSOAP(soapUrl, body, headers)
```

**Parameters**

```
requestUrl:    requested URL  (string)
body:          body of the request (dictionary)
headers:       headers (dictionary)
```

**Returns**

```
The response object from the POST request.
```

## put

Execute​ HTTP put with a given body and a header to the requested URL.

```
HttpApi.put(requestUrl, body)
or
HttpApi.put(requestUrl, body, headers)
```

**Parameters**

```
requestUrl:    requested url (string)
body:          payload (dictionary)
headers:       headers (dictionary)
```

**Returns**

```
The response object from the PUT request.
```

## patch

Execute HTTP patch​ with the requested body and header to a URL.

```
HttpApi.patch(requestUrl, body)
or
HttpApi.patch(requestUrl, body, headers) 
```

**Parameters**

```
requestUrl:     requested url (string)
body:           payload (dictionary)
headers:        headers (dictionary)
```

**Returns**

```
the result of the operation​
```

## delete

Execute HTTP delete with a body and a header to a requested URL.

```
HttpApi.delete(requestUrl, body)
or
HttpApi.delete(requestUrl, body, headers) 
```

**Parameters**

```
requestUrl:      requested url  (string)
body:             body of the request (dictionary)
headers:         headers (dictionary)
```

**Returns**

```
the result of the operation​
```

## getAsString

Description...

```
HttpApi.getAsString(requestUrl, contentType, body)
or
HttpApi.getAsString(requestUrl, contentType, body, headers)
or
HttpApi.getAsString(requestUrl, contentType)
or 
HttpApi.getAsString(requestUrl, contentType, headers)
```

#### Parameters

```
requestUrl (string)
body (dictionary)
contentType (string)
headers (dictionary)
```

#### Returns

```
Result
```

## postAsString

Description...

```
HttpApi.postAsString(requestUrl, body)

or

HttpApi.postAsString(requestUrl, body, headers)
```

#### Parameters

```
requestUrl (string)
body (object)
headers (dictionary)
```

#### Returns

```
Result
```

## putAsString

Description...

```
HttpApi.putAsString(requestUrl, body)

or

HttpApi.putAsString(requestUrl, body, headers)
```

#### Parameters

```
requestUrl (string)
body (object)
headers (dictionary)
```

#### Returns

```
Result
```

## patchAsString

Description...

```
HttpApi.patchAsString(requestUrl, body)

or

HttpApi.patchAsString(requestUrl, body, headers)
```

#### Parameters

```
requestUrl (string)
body (object)
headers (dictionary)
```

#### Returns

```
Result
```

## deleteAsString

Description...

```
HttpApi.deleteAsString(requestUrl, body)

or

HttpApi.deleteAsString(requestUrl, body, headers)
```

#### Parameters

```
requestUrl (string)
body (object)
headers (dictionary)
```

#### Returns

```
Result
```

## readFileAsJSON

Description...

```
HttpApi.readFileAsJSON(String url,
Map<String, String> headerMap)

or

HttpApi.readFileAsJSON(url, encoding, headerMap)
```

#### Parameters

```
url (string)
headerMap (dictionary)
encoding (Charset)
```

#### Returns

```
Result
```

## readFileAsString

Description...

```
HttpApi.readFileAsString(url, headerMap)

or

HttpApi.readFileAsString(url, encoding, headerMap)
```

#### Parameters

```
url (string)
headerMap (dictionary)
encoding (Charset)
```

#### Returns

```
Result
```

## readFileAsBytes

Description...

```
HttpApi.readFileAsBytes(url, headerMap)
```

#### Parameters

```
url (string)
headerMap (dictionary)
```

#### Returns

```
Result
```

## writeFile

Description...

```
HttpApi.writeFile(url, filePath, fileFieldName, headerMap)

or

HttpApi.writeFile(url, filePath, fileFieldName, headerMap, additionalFields)
```

#### Parameters

```
url (string)
filePath (string)
fileFieldName (string)
headerMap (dictionary)
additionalFields (dictionary)
```

#### Returns

```
Result
```

## writeFileBytes

Description...

```
HttpApi.writeFileBytes(url,fileName, fileContent, fileFieldName, headerMap)

or

HttpApi.writeFileBytes(url,fileName, fileContent, fileFieldName, headerMap, 
 additionalFields)

or

HttpApi.writeFileBytes(url, fileName, fileContentAsString, fileFieldName, headerMap)

or

HttpApi.writeFileBytes(url, fileName, fileContentAsString, fileFieldName, headerMap, 
additionalFields)
```

#### Parameters

```
url (string)
fileName (string)
fileContent (List of bytes)
fileFieldName (string)
headerMap (dictionary)
additionalFields (dictionary)
fileContentAsString (string)
```

#### Returns

```
Result
```

## writeFileBytes

Description...

```
HttpApi.httpMethodAsString(requestUrl, method, contentType, body, headers)
```

#### Parameters

```
requestUrl (string)
method (HttpMethod)
contentType (string)
body (object)
headers (dictionary)
```

#### Returns

```
Result
```
