Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

API Project Can you please write detailed explanation for how to use the codes and what codes goes into what class. PART 1 - Making

API Project

Can you please write detailed explanation for how to use the codes and what codes goes into what class.

PART 1 - Making Use of a REST API and Web Requests Make Web Requests to Receive Data (REST)

Weather

Get Local Temperature

https://openweathermap.org/api

For example: You can hit a URL like : api.openweathermap.org/data/2.5/forecast?lat=35&lon=139

image text in transcribed

The response format that you get is called JSON (Javascript Object Notation). You will want to read up more on this (http://codular.com/json). A good JSON editor is: http://www.jsoneditoronline.org/It can easily parse it and let you understand the JSON.

Your Java Program will need to parse the JSON to make use of the data. You will definitely need to use a library to parse the Json. GSON is a good library to use, look it up on your own. Use this website for reference:

http://www.oracle.com/technetwork/articles/java/json-1973242.html

Ideally, you will want to make a method that you can call in your Java program that return this information to you. For example a function like: int getWeather(string city) -> returns the current temperature from the Weather API

PART 2 - Creating a Interfaceable Chat Bot

You will want to first create a simple program that can connect to the Chat Server. The chatserver we will be using is called FreeNode.

http://www.jibble.org/pircbot.php Here is some sample code to s

Use Java.Net Library to create a Chat Server

Directions are provided below

You will expose your bot so anyone can interact with it

Check next page for code sample

When the bots connected to the group chat it should read the messages and when a message matches a command it respond accordingly. This means if someone says Weather 75080 it should return parse the words and query the weather API and return the information in a IRC-friendly format (The weathers going to be X.

Use command phrases that trigger a response

Weather 75080

Hows the weather in 75080?

Use your wrapper and respond accordingly.

It doesnt have to use Natural Language Processing, keywords is fine

image text in transcribed

f"city""id":1851632, "name": "Shuzenji", "coord":{"lon" :138.933334, "lat":34.966671, "country": "JP", "cod": "200" "message":0.0045 "cnt": 38, "list": "dt":1406106000 main": "temp" 298.77, temp_min" :298.77, temp-max" :298.774, pressure" 1005.93, "sea level": 1018.18 "grnd level":1005.93, "humidity":87 "temp_kf":0.26, "weather"["id":804, "main" : "Clouds", "description" : "overcast clouds "clouds":"all": 88, "wind" :"speed" :5.71, "deg" :229.501, "sys" "pod": "d", "dt txt" : "2014-07-23 09:00:00" f"city""id":1851632, "name": "Shuzenji", "coord":{"lon" :138.933334, "lat":34.966671, "country": "JP", "cod": "200" "message":0.0045 "cnt": 38, "list": "dt":1406106000 main": "temp" 298.77, temp_min" :298.77, temp-max" :298.774, pressure" 1005.93, "sea level": 1018.18 "grnd level":1005.93, "humidity":87 "temp_kf":0.26, "weather"["id":804, "main" : "Clouds", "description" : "overcast clouds "clouds":"all": 88, "wind" :"speed" :5.71, "deg" :229.501, "sys" "pod": "d", "dt txt" : "2014-07-23 09:00:00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

l Develop an organization chart using job families.

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago