# HttpApi (HTTP APIs)

## get

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

```
HttpApi.get(String requestUrl) 
or
HttpApi.get(String requestUrl, Map<String, String> headers)
or
HttpApi.get(String requestUrl, Map<String, String> headers, Integer retryCount, Integer waitTime)
or 
HttpApi.getWithRetry(String requestUrl, Map<String, String> headers)
```

**Parameters**

```
requestUrl
headers
retryCount
waitTime
```

**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) 
or
HttpApi.postFormData(String requestUrl, Map<String, String> body, Map<String, String> headers)
or
HttpApi.postFormDataAsString(String requestUrl, Map<String, String> body, Map<String, String> headers)
or
HttpApi.postSOAP(String soapUrl, String 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, String contentType, Object body)
or
HttpApi.getAsString(String requestUrl, String contentType, Object body, Map<String, String> headers)
or
HttpApi.getAsString(String requestUrl, String contentType)
or 
HttpApi.getAsString(String requestUrl, String contentType, Map<String, String> headers)
```

#### Parameters

```
requestUrl
body
contentType
headers
```

#### Returns

```
Result
```

## postAsString

Description...

```
HttpApi.postAsString(String requestUrl, Object body)

or

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

#### Parameters

```
requestUrl
body
headers
```

#### Returns

```
Result
```

## putAsString

Description...

```
HttpApi.putAsString(String requestUrl, Object body)

or

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

#### Parameters

```
requestUrl
body
headers
```

#### Returns

```
Result
```

## patchAsString

Description...

```
HttpApi.patchAsString(String requestUrl, Object body)

or

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

#### Parameters

```
requestUrl
body
headers
```

#### Returns

```
Result
```

## deleteAsString

Description...

```
HttpApi.deleteAsString(String requestUrl, Object body)

or

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

#### Parameters

```
requestUrl
body
headers
```

#### Returns

```
Result
```

## 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

```
Result
```

## 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

```
Result
```

## readFileAsBytes

Description...

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

#### Parameters

```
url
headerMap
```

#### Returns

```
Result
```

## 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

```
Result
```

## 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

```
Result
```

## writeFileBytes

Description...

```
HttpApi.httpMethodAsString(String requestUrl, HttpMethod method, String contentType, Object body,
      Map<String, String> headers)
```

#### Parameters

```
requestUrl
method
contentType
body
headers
```

#### Returns

```
Result
```
