04. Table 4.1 lists the endpoints of a RESTful API for the resource named movies HTTP Verb GET GET POST PUT DELETE URI D

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

04. Table 4.1 lists the endpoints of a RESTful API for the resource named movies HTTP Verb GET GET POST PUT DELETE URI D

Post by answerhappygod »

04 Table 4 1 Lists The Endpoints Of A Restful Api For The Resource Named Movies Http Verb Get Get Post Put Delete Uri D 1
04 Table 4 1 Lists The Endpoints Of A Restful Api For The Resource Named Movies Http Verb Get Get Post Put Delete Uri D 1 (68.47 KiB) Viewed 50 times
04. Table 4.1 lists the endpoints of a RESTful API for the resource named movies HTTP Verb GET GET POST PUT DELETE URI Description /apimovies Get a listing of movies resources /api/movies/(movie) Get a movies resource lapimovies Stores a new movies resource lapimovies/(movie) Update a movies resource /api/movies/(movie) Destroys a movies resource Table 4.1: Endpoints of a RESTful API for the resource movies The endpoint GET /api/movies/[movie) returns a JSON response as shown in the sample JSON response in Figure 4.2. "Id"12977, "title":"Litetine Treasure release_date":1549324800, "language":"Cantonese genre "Comedy length:95 , *Synapsis". In a peaceful elderly hone, 1ste goes on.... 13 Figure 4.2: Sample JSON response The endpoint GET /apVmovies in turn returns a JSON response containing an array of the JSON objects in Figure 4.2. (a) Construct JavaScript code using the React library to fetch from the endpoint GET /api/movies to display a listing of movies in a HTML Table as shown in the sample in Figure 4.3. Title Language Genre A Lifetime Treasure Cantonese Comedy A Journey Of Happiness Cantonese Family Amazing Spring Cantonese Drama The Knight of Shadows Between Yin & Yang Cantonese Action Figure 4.3: Sample HTML Table (10 marks) This question paper consists of 5 questions on 10 printed pages. UECS3294 ADVANCED WEB APPLICATION DEVELOPMENT 04. (Continued) ( (b) Construct JavaScript code using the React library to fetch from the endpoint GET /api/movies/movie). Upon success, render a HTML Form with the details from the JSON response filled in the form clements as shown in the sample HTML Form in Figure 4.4 A Lifetime Treasure Title Release Date 2019-02-05 Language Cantonese Genre Comedy Length 95 In a peaceful elderly home life goes on Synopsis Save Figure 4.4: Sample HTML Form Clicking on the Save button will cause the script to fetch from the endpoint PUT /api/movies/(movie) to perform an update based on any input provided by the user via the HTML form. Upon success, display an appropriate message using a a JavaScript alert. (15 marks) [Total: 25 marks)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply