0% found this document useful (0 votes)
64 views

JS-Applications-HTTP-and-REST-Services-Exercise

Uploaded by

Martin Simov
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

JS-Applications-HTTP-and-REST-Services-Exercise

Uploaded by

Martin Simov
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Exercise: REST Services and AJAX

Problems for exercises and homework for the "JavaScript Applications" course @ SoftUni.

Working with Remote Data


For the solution of some of the following tasks, you will need to use an up-to-date version of the local REST service,
provided in the lesson’s resources archive. You can read the documentation here.

1. REST Countries
NOTE: Install "Postman" REST Client to ease your tasks.
 Manually compile an HTTP (as text) request for retrieving information about Bulgaria;
 Use Postman to make the same request;
 Make a request that retrieving only the fields name, capital, region, population for the country Italy.
 Make a request that takes all German-speaking countries.
Your first task is to get detailed information about Bulgaria.
 Send a "GET" request to the link given below.
REQUEST:
https://restcountries.com/v2/name/Bulgaria

RESPONSE:

Each API has documentation, where you can see how to use the API. You can find the documentation of this API
here: https://restcountries.com/
 Now try to filter only specific fields of the information about Italy. Send a GET request with the needed
parameter to get a response only with this information about the country:
- name, capital, region and population;

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 1 of 9
 There is a way to get a response holding all the countries, which citizens speak the German language. Send
a GET request to become the information for these countries (Austria, Belgium, Germany, Holy See,
Liechtenstein, Luxembourg, Switzerland), but filter the response to have only their names and region.

2. Bus Stop
Perform an HTTP request that displays arrival times for all buses by a given bus stop ID.
 GET: http://localhost:3030/jsonstore/bus/businfo/:busId
You will receive a JSON object in the format:
stopID: {
name: stopName,
buses: { busId: time, … }
}

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 2 of 9
Hints
The webhost will respond with valid data to IDs 1287, 1308, 1327 and 2334.

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 3 of 9
3. Phonebook GET
Perform an HTTP request that show people’s names, their phones and _id.
GET requests: http://localhost:3030/jsonstore/phonebook

4. Phonebook POST
Create two different requests with POST request in Postman. The data sent in a POST request should be a valid JSON
object, containing properties person and phone. Example format:
{
"person": "<person>",
"phone": "<phone>"
}
POST: http://localhost:3030/jsonstore/phonebook

5. Employees
Use the link below to get, post, put and delete request in Postman. Send five types of requests supported by the API.
 http://dummy.restapiexample.com/

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 4 of 9
- GET REQUEST
Use the link in Full Route section to get all employee data and single employee data.

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 5 of 9
- POST REQUEST
Create new record in database

- PUT REQUEST
Update an employee record

- DELETE REQUEST
Delete an employee record

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 6 of 9
6. Firebase App
Create Firebase application to configure a collection. In that case your collection will be with books and authors.
Use postman to create, read, delete entries from the collection.

Books Genre Title Author

Get Out of Your Head: Stopping the Jennie Allen


Spiral of Toxic Thoughts:
Non-Fiction
Trust: America’s Best Chance Pete Buttigieg

When Breath Becomes Air Paul Kalanithi

It Ends With Us Colleen Hoover


Romance
The Proposal Jasmine Guillory

Thrillers Gone Girl Gillian Flynn

 Use JS-Applications-Remote-Databases-Guide.

7. Backendless App
Create Backendless music application. It has to contain title and singer.
Use Postman to create, read, delete entries from collection.

Singer Title

Eminem Cinderella Man

Alan Walker Faded

Dove Cameron We Belong

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 7 of 9
 Use JS-Applications-Remote-Databases-Guide.

8. Back4App App
Create Back4App App for students. It has to contain first name, last name and average grade.
Use Postman to create, read, delete entries from collection.

First Name Last Name Average Grade

James Christopher 5.70

Barbara Smith 4.90

Sarah Johnson 5.90

William Miller 3.30

Matthew Taylor 4.10

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 8 of 9
 In Postman you must add headers.

 Use JS-Applications-Remote-Databases-Guide.

© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Follow us: Page 9 of 9

You might also like