Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // login data
- ObjectNode tvdbaccount = Json.newObject();
- tvdbaccount.put("apikey", "*****");
- tvdbaccount.put("username", "*****");
- tvdbaccount.put("userkey", "*****");
- // try to login
- String token = "";
- CompletionStage<JsonNode> request = WS.url("https://api.thetvdb.com/login").post(tvdbaccount).thenApply(WSResponse::asJson);
- try {
- JsonNode response = request.toCompletableFuture().get(5, TimeUnit.SECONDS);
- token = response.get("token").asText();
- } catch (Exception ex) {
- System.out.println(ex.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement