To store an element at a URI, the PUT function can create a new element or update a current one. A PUT request is idempotent. Idempotency is the fundamental contrast between the desires for PUT versus a POST request.
Here are the common functions of HTTP PUT:
Here are the common functions -
@Throws(RestClientException::class)
fun put(url: String, request: Any, vararg urlVariables: Any)
@Throws(RestClientException::class)
fun put(url: String, request: Any, urlVariables: Map<String, *>)
@Throws(RestClientException::class)
fun put(url: String, request: Any, urlVariables: Map<String, *>)
Here is an example of how to call the functions of HTTP PUT:
val baseUrl: String ?= "YOUR_URL"
val restTemplate = RestTemplate()
val uri = URI(baseUrl)
val body = "The Body"
restTemplate.put(baseUrl, body)
restTemplate.put(uri, body)