Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageperl
linenumberstrue
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/QA-31
或者
curl -D- -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "X-Atlassian-Token: no-check" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/QA-31"

...

Code Block
languagejava
linenumberstrue
import com.sun.jersey.api.client.*;

public class BaseClientMain {
    public static void main(String[] args) throws Exception {
        try {
            Client client = Client.create();
            WebResource webResource = client.resource("http://localhost:8080/rest/api/2/issue/QA-31");
            ClientResponse response = webResource.accept("application/json")
                    .header("Authorization", "Basic YWRtaW4lM0FhZG1pbg==")
                    .header("X-Atlassian-Token", "no-check") 
					.get(ClientResponse.class);
            String msgback = response.getEntity(String.class);
            System.out.println(msgback);
            response.close();
        } catch (UniformInterfaceException e) {
            e.printStackTrace();
        } catch (ClientHandlerException e) {
            e.printStackTrace();
        }
    }
}

...