DEV Community

loizenai
loizenai

Posted on

Kotlin – RestTemplateClient Send/Recieve Base64 File/Image to SpringBoot server

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-resttemplateclient-sendrecieve-base64-fileimage-springboot-server

Kotlin – RestTemplateClient Send/Recieve Base64 File/Image to SpringBoot server

In the tutorial, we guide how to post/get base64 files/images by RestTemplateClient to SpringBoot server with Kotlin language.

I. Technologies

– Java 1.8
– Kotlin 1.2.20
– Spring Tool Suite – Version 3.9.2.RELEASE
– Spring Boot – 1.5.10.RELEASE
– Apache Maven 3.5.2

II. Goal

We create 2 Kotlin SpringBoot projects {KotlinRestfulAPIs, KotlinRestTemplateClient} as below:

Kotlin Springboot post-get base64 file image with RestTemplateClient - projects

KotlinRestfulAPIs project provides 2 RestAPIs:


@PostMapping(value = "/post")
fun post(@RequestBody image: ImageData): String
...

@GetMapping(value = "/get")
fun get(@RequestParam("name") name: String): ImageData 
...

More at:

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-resttemplateclient-sendrecieve-base64-fileimage-springboot-server

Top comments (0)