-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha3.html
More file actions
214 lines (188 loc) · 10.3 KB
/
Copy patha3.html
File metadata and controls
214 lines (188 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Web Serivice</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<!-- css stylesheet -->
<link href="style.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Lato:300,700%7COpen+Sans">
<!-- javascript and jQuery -->
<script type="text/javascript" src="jquery-3.0.0.js" defer></script>
<script type="text/javascript" src="script.js" defer></script>
</head>
<body>
<div class="wrapper">
<header>
<h1>My New York Times</h1>
</header> <!-- end header -->
<main>
<h2>
Eight RESTful APIs are available for use. The first six
can be accessed using HTTP GET requests, while the last
two require HTTP POST requests. Click Show Info to see the
details.
</h2>
<!-- Button to open the modal login form -->
<button class="button4" id="login">Log in</button>
<button class="button4" id="logoff">Log off</button>
<!-- Button to open the modal feedback form -->
<button class="button4" id="showFeedback">Feedback</button>
<section id="modal">
<article id="hideForm">×</article>
<form class="modal-content animate" method="post">
<article class="container">
<label>Username</label>
<input id="u" type="text" placeholder="Enter Username" name="uname" required autocomplete=default>
<label>Password</label>
<input id="p" type="password" placeholder="Enter Password" name="pwd" required>
<button class="button1" type="submit">Sign up / Login</button>
<input type="checkbox" checked="checked"> Remember me
</article>
<article class="container">
<button class="button4" type="button" id="cancel">Cancel</button>
</article>
</form>
</section>
<!-- End The Modal -->
<section id="modal2">
<form class="modal-content animate" method="post">
<article class="container">
<label>What do you think we can improve upon?</label>
<textarea name="fb" rows="6" cols="50" required></textarea>
<button class="button1" type="submit">Send</button>
</article>
<article class="container">
<button class="button4" type="button" id="cancel2">Cancel</button>
</article>
</form>
</section>
<!-- End The Modal2 -->
<button id="showInfo" class="button4">Show Info</button>
<button id="hideInfo" class="button4">Hide Info</button>
<section id="info">
<p>Note: the format of published_date would be
YYYY-MM-DDTHH:MM:SS-MM:SS, where the "T" in the middle
stands for time, and minutes and seconds are a range.
</p><br>
<h2>GET REQUESTS</h2>
<ol>
<li>url: /text-articles;
<ul>
<li>return: a list of articles;</li>
<li>fields: title, abstract, published_date, and short_url.</li>
</ul>
</li>
<li>url: /authors;
<ul>
<li>return: a list of authors;</li>
<li>field: author;</li>
<li>note: one author field may contain more than one authors.</li>
</ul>
</li>
<li>url: /urls;
<ul>
<li>return: a list of urls grouped by published dates;</li>
<li>fields: published_date, short_urls;</li>
<li>note: published dates are not sorted.</li>
</ul>
</li>
<li>url: /tags;
<ul>
<li>return: a list of all the tags;</li>
<li>field: des_facet;</li>
<li>note: some tags may appear more than once.</li>
</ul>
</li>
<li>url: /article/ + index;
<ul>
<li>return: an article specified by index;</li>
<li>fields: section, subsection, title, abstract, byline, published_date, des_facet;</li>
<li>note:
<ul>
<li>index should be a positive interger;</li>
<li>null is returned if index is not valid;</li>
<li>returned value is enclosed in index 0 of an array, so use [0] to access it.</li>
</ul>
</li>
</ul>
</li>
<li>url: /media-articles;
<ul>
<li>if multimedia(images) exist:
<ul>
<li>return: a list of articles with images and url linking to the original article;</li>
<li>fields: multimedia, short_url;</li>
<li>subfields of multimedia: url, caption, width, height;</li>
<li>note: multimedia may contain more than one images;</li>
</ul>
</li>
<li>else:
<ul>
<li>return: a list of articles with title and url linking to the original article;</li>
<li>fields: title, short_url.</li>
</ul>
</li>
</ul>
</li>
</ol>
<h2>POST REQUEST</h2>
<ol>
<li>url: /;
<ul>
<li>funcion: allow users to sign up (if the username does not exist) or log in;</li>
<li>fields: section, subsection, title, abstract, byline, published_date, des_facet;</li>
<li>return:
<ul>
<li>"Signed up";</li>
<li>"Logged in";</li>
<li>"Wrong password";</li>
</ul>
</li>
<li>note:
<ul>
<li>highly recommend using a form to transfer the information;</li>
<li>when setting up the form, the username should have name uname, and the password should have pwd as name;</li>
<li>passwords are hashed at server-side using a hash function similar to hashCode() in Java.</li>
</ul>
</li>
</ul>
</li>
<li>url: /feedback;
<ul>
<li>function: allow users to submit feedback regarding this webpage, which will not associated with this user;</li>
<li>return: none;</li>
<li>note: only logged in users can submit feedback; this is to prevent spam</li>
</ul>
</li>
</ol>
</section>
<section id="control">
<!-- instructions and buttons for users -->
<h2>There are seven buttons below, each of the first six representing an
ajax call to the server to retrive certain information.
The last button will allow you to sign up or log in. After you are logged in,
you will be able to submit feedback about this webpage.
</h2><br>
<button class="button1" id="textArticles">Text Articles</button><br>
<button class="button2" id="authors">All Authors</button><br>
<button class="button3" id="urls">All URLs</button><br>
<button class="button1" id="tags">All Tags</button><br>
<button class="button2" id="article">Article</button>
<p>about article #</p>
<input type="number" id="index" value="0"><br>
<button class="button3" id="mediaArticles">Media Articles</button>
</section>
<article id="snackbar"></article>
<section id="display">
<!-- all the response displayed here -->
</section>
</main> <!-- end main -->
<footer>
<h3>Copyright 2016.</h3>
<a href="http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/">hash function source</a>
</footer> <!-- end footer -->
</div>
</body>
</html>