等同于curl查询的Java [英] Java Equivalent of curl query
问题描述
我正在尝试使用android的sdk框使当前用户登录到他的框后,以获取当前用户信息。在box api文档中,他们提到了使用curl的所有内容。我不熟悉卷曲。因此,任何人都可以给我Java等效于此curl操作的方法:
I am trying to fetch current user info after making him log into his box, using the box sdk for android. In the box api documentation, they have mentioned everything using curls. I am not familiar with curl. So, can anyone please give me a java equivalent for this curl operation :
curl https://api.box.com/2.0/users/me-H "Authorization: Bearer ACCESS_TOKEN".
我有用户访问令牌。因此,请给我一个上述等效curl操作的Java等效项。
I have the users access token.So, please give me a java equivalent for the above curl operation.
推荐答案
另一个答案提出的HttpClient对象现已弃用。我解决了一个像您一样的CURL问题(上传.wav文件非常困难)。在此答案/问题中查看我的代码。 如何使用URLConnection上传WAV文件
The HttpClient object that the other answer proposes is now deprecated. I solved a CURL problem like yours (with the extra difficulty of uploading a .wav file). Check out my code in this this answer/question. How to upload a WAV file using URLConnection
这篇关于等同于curl查询的Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!