2016-04-19 24 views
-1

我有以下的卷曲请求任何人都可以跟我确认这将是后续的HTTP请求:转换CURL请求HTTP请求的Java通过GET方法,

curl -i -L -H "Accept: application/json" --data "client_id=APP-UJA2FDFLIVK14WMW&client_secret=6d8d32f1-1c25-4356-8b15-4d803d9a869e&grant_type=authorization_code&code=dj4kYk&redirect_uri=https://developers.google.com/oauthplayground" "https://api.sandbox.orcid.org/oauth/token" 

任何人都可以是一种足以帮助我转换成以上curl请求完全到httpreq。

+2

你应该先尝试一下,如果你卡住了,请发表你的问题。 – Abhishek

回答

0

,你应该看看这篇文章:Using java.net.URLConnection to fire and handle HTTP requests

你应该能够通过数据部分的是:

URLConnection connection = new URL(url + "?" + dataString).openConnection(); 

使用:

connection.setRequestProperty("Accept: application/json", charset); 

添加页眉

这是一个起点...