1

我想使用 Rest API 在 java 程序中创建/修改工作项。我的服务器是 Apache-coyote/1.1。

 HttpClient client = new DefaultHttpClient();
    JSONObject JSONobj = new JSONObject();
    System.out.println("hello ");
    HttpPost post = new HttpPost("https://");
    post.setHeader("Content-Type", "application/json  ");
    post.setHeader("xyz","abcd");   //userid and password

    StringEntity input = new StringEntity(JSONobj.toString());

    System.out.println("hello ");
    post.setEntity(input);
    System.out.println("hello ");

    HttpResponse response = client.execute(post);

在此处输入图像描述

4

0 回答 0