i have get the sign transaction hash, then, i send RPC request(/injection/operation) like this to brocast operation, this is my junit test, but it return 415 not support media type, i guess because of the requestBody must send a str, but it not a json, but i tried to change the content-type, it not in used. enter image description here

  • Updated my answer with a code example. It seems that you need to set "text/plain" in the Content-Type. Commented Apr 26, 2022 at 21:50

1 Answer 1


Have a look at TezosJ_SDK/TezosGateway.java (query method).

    MediaType MEDIA_PLAIN_TEXT_JSON = MediaType.parse("application/json");

    String s = "a3...";
    RequestBody body = RequestBody.create(MEDIA_PLAIN_TEXT_JSON, s.getBytes());
    Request request = new Request.Builder()
            .addHeader("Content-Type", "text/plain")

    OkHttpClient client = new OkHttpClient.Builder().build();

    try {
        Response response = client.newCall(request).execute();
        String strResponse = response.body().string();
    } catch ...
  • thanks a lot for help me to deal the problem, i follow your sugestion to update my code, but it return me a new http status 400, message is "bad request", there is my code:
    – tracverson
    Commented Apr 27, 2022 at 2:02
  • my code is very similar with your code, why return a 400 bad request
    – tracverson
    Commented Apr 27, 2022 at 2:07
  • The operation bytes need to be valid ("a3...." is not valid, I just used it as a placeholder). Usually, the 400 status returns some details about what is wrong. Commented Apr 27, 2022 at 6:19
  • i got the reason why return 400, because the rawTransaction hash need surround with " to send in requestBody, i have never see this type of send requestBody, it is amazing
    – tracverson
    Commented Apr 27, 2022 at 9:13
  • It is a JSON string. Commented Apr 27, 2022 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.