import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.JsonNode; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; public class UnirestExample { public static void main(String[] args) { try { HttpResponse<JsonNode> response = Unirest.get("https://api.example.com/user") .header("accept", "application/json") .queryString("name", "John") .asJson(); int status = response.getStatus(); JsonNode body = response.getBody(); if (status == 200) { } else { } } catch (UnirestException e) { } } }


上一篇:
下一篇:
切换中文