Ananiya
11/04/2020, 11:43 AMPOST <https://api.eu-gb.language-translator.watson.cloud.ibm.com/instances/XXXXXXX-c497-406d-9ea0-ae0253820616/v3/translate?version=2018-05-01>
Authorization: Basic apikey a31c_12usVFPhhF2z9iLokWp-XXXXXXXXXXX
Content-Type: application/json
{"text": ["Hello, world.", "How are you?"], "model_id":"en-es"}
###
hopefully it worked but after i implement my code like this with okhttp(kotlin)
val client = OkHttpClient()
val json = """{"text": ["Hello, world.", "How are you?"], "model_id":"en-es"}"""
val request = RequestBody.create(MediaType.get("application/json; charset=utf-8"),json)
val response = Request.Builder()
.url("<https://api.eu-gb.language-translator.watson.cloud.ibm.com/instances/XXXXXXXX-c497-406d-9ea0-ae0253820616/v3/translate?version=2018-05-01>")
.addHeader("Authorization","Basic apikey a31c_12usVFPhhF2z9iLokWp-XXXXXXXXXXX")
.post(request)
.build()
val answer = client.newCall(response).execute().body()!!.string()
println(answer)
it start throwing error from the server, i don't know if i put the POST wrongly