How to send Request payload to REST API in java?

前端 未结 2 1529
清酒与你
清酒与你 2020-11-30 03:57

I want to retrieve the JSON data from the following: https://git.eclipse.org/r/#/c/11376/

Request URL: https://git.eclipse.org/r/gerrit/rpc/ChangeDetailService

2条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 04:24

    I tried with a rest client.

    Headers :

    • POST /r/gerrit/rpc/ChangeDetailService HTTP/1.1
    • Host: git.eclipse.org
    • User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0
    • Accept: application/json
    • Accept-Language: null
    • Accept-Encoding: gzip,deflate,sdch
    • accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
    • Content-Type: application/json; charset=UTF-8
    • Content-Length: 73
    • Connection: keep-alive

    it works fine. I retrieve 200 OK with a good body.

    Why do you set a status code in your request? and multiple declaration "Accept" with Accept:application/json,application/json,application/jsonrequest. just a statement is enough.

提交回复
热议问题