我正计划使用文本上传网站http://textuploader.com/,但我似乎对此并不了解。我可能看起来不够努力,但这不是重点。我真正要寻找的只是简单地如何执行这些命令,或者只是如何使用“ HTTPClient”来完成这些事情。包含所有命令和信息的站点为here。另外,为方便起见,在这篇文章中,我应该把最重要的部分留给我:

POST: /posts

This will allow you to post to your account.

{
   "Title": "Sample Title",
   "Content": "Post body goes here.",
   "Type": "public"
}

Example:

curl -X POST "http://api.textuploader.com/v1/posts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-TextUploader-API-Key: your-api-key-here" \
-v \
-d '{"title": "Sample Title", "content": "Post body goes here.", "type": "public"}'

And this:

GET: /posts/[shortcode]

This method will return the complete body of the requested shortcode.

最佳答案

Nicolas Filotto在这里的答案很完美:How to make post curl request in java

如果您希望留在此页面上,就可以在这里:

如果您是我,则可以使用DavidWebb轻量级Java HTTP-Client来调用JSON REST-Services,然后继续进行以下操作:

Webb webb = Webb.create();
JSONObject result = webb
    .post("https://api.gupshup.io/appsdk/api/components/adduser")
    .header("Content-Type", "application/x-www-form-urlencoded")
    .header("apikey", "xxxx")
    .body("name=abcd&email=test@test.com.com&id=abc")
    .asJsonObject()
    .getBody();

10-07 18:58
查看更多