i bought the API but the java code on the rapidapi is not working so could you provide the correct java code as i really need it for my graduation project
i am trying this in postman but geting below error { “detail”: [ { “loc”: [ “body”, “image” ], “msg”: “field required”, “type”: “value_error.missing” } ] }
Here is some code I generated using postman which uses the okhttp library
OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("text/plain"); RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("image","lawrence.jpg", RequestBody.create(MediaType.parse("application/octet-stream"), new File("somefile.jpg"))) .build(); Request request = new Request.Builder() .url("https://toonify.p.rapidapi.com/v0/toonify") .method("POST", body) .addHeader("x-rapidapi-key", "YOUR_RAPID_API_KEY_HERE") .addHeader("x-rapidapi-host", "toonify.p.rapidapi.com") .build(); Response response = client.newCall(request).execute();
Doe mee aan de discussie - voeg hieronder een opmerking toe
i am trying this in postman but geting below error
{
“detail”: [
{
“loc”: [
“body”,
“image”
],
“msg”: “field required”,
“type”: “value_error.missing”
}
]
}
Here is some code I generated using postman which uses the okhttp library