Convert Curl to Java equivalent

前端 未结 1 332
清酒与你
清酒与你 2021-01-14 04:55

I\'m working with New Relic REST API for the first time, I have a curl command:

curl -X GET \'https://api.newrelic.com/v2/applications/appid/me         


        
相关标签:
1条回答
  • 2021-01-14 05:36

    curl -d sends whatever you specify without formatting it in any way. Just send the string names[]=EndUser/... in the OutputStream, without wrapping it in a JSONObject. Don't forget to call wr.flush() after writing the string. And of course, after that, you need to get the InputStream and start reading from it (I only mention this because it's not in your snippet).

    0 讨论(0)
提交回复
热议问题