Benefits of using an Urban Dictionary API!

There are numerous dictionary API services available on the web that enable users to look up word definitions. However, the Urban Dictionary API sets itself apart in two significant aspects. Support for slang words and colloquial phrases and a Community-driven user-contributed rating system. The community-driven approach of the Urban Dictionary influences both these aspects. Since the user community collectively contributes to the dictionary, more contemporary, slang, and colloquial phrases are continuously added to the dictionary database. Thus the dictionary is richer and more relevant to the current times. Moreover, the user-contributed rating system allows users to rate word definitions and usage examples using up-votes and down-votes. This further democratizes the relevance of word definitions. Thus an end-user is presented with a list of word definitions and their corresponding example usages in addition to their up-votes and down-votes. This empowers the end-user with a choice to select and use a particular word definition and example from the returned list of multiple definitions.

// package examples;

// import org.json.JSONArray;

// import urbanapi.Definition;
// import urbanapi.UDParser;

public class APITestDriver 
{
	public static void main (String[] args)
	{
		UDParser udparser = new UDParser("http://api.urbandictionary.com/v0/");
		String JSONData = udparser.getJSONData("chris+hansen");
		// String JSONData = udparser.getJSONData(6730949);
		// System.out.println(JSONData);
		Definition[] test = udparser.getDefinitionsWithJSONData(JSONData);
		for(int i = 0; i < test.length; i++)
		{
			System.out.println("WORD");
			System.out.println(test[i].getWordName());
			System.out.println("DEFINITION");
			System.out.println(test[i].getDefinition());
			System.out.println("AUTHOR");
			System.out.println(test[i].getAuthor());
			System.out.println("WRITTEN DATE");
			System.out.println(test[i].getWrittenDate());
			System.out.println("REFERENCE ID");
			System.out.println(test[i].getRefID());
			System.out.println("PERMALINK");
			System.out.println(test[i].getPermalink());
		}
		JSONArray keywordTags = udparser.getTagsWithJSONData(JSONData);
		System.out.println("TAGS");
		for(int i = 0; i < keywordTags.length(); i++)
		{
			System.out.println(keywordTags.get(i));
		}
	}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;


HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://mashape-community-urban-dictionary.p.rapidapi.com/define?term=wat"))
.header("X-RapidAPI-Key", "b256ce775fmsh9e5a7319b6e6e38p1d5c1fjsnae19e21ba599")
.header("X-RapidAPI-Host", "mashape-community-urban-dictionary.p.rapidapi.com")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Football Example API!

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpRequest request = HttpRequest.newBuilder()
		.uri(URI.create("https://nfl-schedule.p.rapidapi.com/v1/schedules"))
		.header("X-RapidAPI-Key", "9fb1283360mshedc514375b603d6p156a26jsna7cd4ca5744a")
		.header("X-RapidAPI-Host", "nfl-schedule.p.rapidapi.com")
		.method("GET", HttpRequest.BodyPublishers.noBody())
		.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
{"message":"NFL Scheduled games","data":[{"date":"2022-10-07T00:15Z","venue":"Empower Field at Mile High","name":"Indianapolis Colts at Denver Broncos","shortName":"IND @ DEN","awayTeam":{"name":"Colts","score":"0"},"homeTeam":{"name":"Broncos","score":"0"}},{"date":"2022-10-09T13:30Z","venue":"Tottenham Hotspur Stadium","name":"New York Giants at Green Bay Packers","shortName":"NYG @ GB","awayTeam":{"name":"Giants","score":"0"},"homeTeam":{"name":"Packers","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"Highmark Stadium","name":"Pittsburgh Steelers at Buffalo Bills","shortName":"PIT @ BUF","awayTeam":{"name":"Steelers","score":"0"},"homeTeam":{"name":"Bills","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"FirstEnergy Stadium","name":"Los Angeles Chargers at Cleveland Browns","shortName":"LAC @ CLE","awayTeam":{"name":"Chargers","score":"0"},"homeTeam":{"name":"Browns","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"U.S. Bank Stadium","name":"Chicago Bears at Minnesota Vikings","shortName":"CHI @ MIN","awayTeam":{"name":"Bears","score":"0"},"homeTeam":{"name":"Vikings","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"Gillette Stadium","name":"Detroit Lions at New England Patriots","shortName":"DET @ NE","awayTeam":{"name":"Lions","score":"0"},"homeTeam":{"name":"Patriots","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"Caesars Superdome","name":"Seattle Seahawks at New Orleans Saints","shortName":"SEA @ NO","awayTeam":{"name":"Seahawks","score":"0"},"homeTeam":{"name":"Saints","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"MetLife Stadium","name":"Miami Dolphins at New York Jets","shortName":"MIA @ NYJ","awayTeam":{"name":"Dolphins","score":"0"},"homeTeam":{"name":"Jets","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"Raymond James Stadium","name":"Atlanta Falcons at Tampa Bay Buccaneers","shortName":"ATL @ TB","awayTeam":{"name":"Falcons","score":"0"},"homeTeam":{"name":"Buccaneers","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"FedExField","name":"Tennessee Titans at Washington Commanders","shortName":"TEN @ WSH","awayTeam":{"name":"Titans","score":"0"},"homeTeam":{"name":"Commanders","score":"0"}},{"date":"2022-10-09T17:00Z","venue":"TIAA Bank Field","name":"Houston Texans at Jacksonville Jaguars","shortName":"HOU @ JAX","awayTeam":{"name":"Texans","score":"0"},"homeTeam":{"name":"Jaguars","score":"0"}},{"date":"2022-10-09T20:05Z","venue":"Bank of America Stadium","name":"San Francisco 49ers at Carolina Panthers","shortName":"SF @ CAR","awayTeam":{"name":"49ers","score":"0"},"homeTeam":{"name":"Panthers","score":"0"}},{"date":"2022-10-09T20:25Z","venue":"SoFi Stadium","name":"Dallas Cowboys at Los Angeles Rams","shortName":"DAL @ LAR","awayTeam":{"name":"Cowboys","score":"0"},"homeTeam":{"name":"Rams","score":"0"}},{"date":"2022-10-09T20:25Z","venue":"State Farm Stadium","name":"Philadelphia Eagles at Arizona Cardinals","shortName":"PHI @ ARI","awayTeam":{"name":"Eagles","score":"0"},"homeTeam":{"name":"Cardinals","score":"0"}},{"date":"2022-10-10T00:20Z","venue":"M&T Bank Stadium","name":"Cincinnati Bengals at Baltimore Ravens","shortName":"CIN @ BAL","awayTeam":{"name":"Bengals","score":"0"},"homeTeam":{"name":"Ravens","score":"0"}},{"date":"2022-10-11T00:15Z","venue":"GEHA Field at Arrowhead Stadium","name":"Las Vegas Raiders at Kansas City Chiefs","shortName":"LV @ KC","awayTeam":{"name":"Raiders","score":"0"},"homeTeam":{"name":"Chiefs","score":"0"}}]}