Source

rest-assured-samples / src / main / webapp / index.html

The default branch has multiple heads

<html>
	<head>
		<title>hasCode.com - REST-assured Examples</title>
		<style type="text/css">
			body {
				font-family: Arial, sans-serif;
			}
			h1 {
				font-size:20px;
				border-bottom:5px solid #000;
				margin-top:20px;
			}
				
			table, td {
				border:1px solid #000;
				padding: 10px;
				border-collapse:collapse;
				font-size:12px;
			}	
			th {
				background-color:#000;
				color:#fff;
				font-size:13px;
				height:20px;
				padding:5px 10px;
			}
			blockquote {
				text-align:left;
			}
			em {
				font-weight:bold;
				font-style:normal;
				font-size:13px;
			}
			.type {
				background-color:#666;
			}
			.header {
				background-color:#ddd;
			}
		</style>
	</head>
	<body>
		<h1>hasCode.com REST-assured Examples</h1>
		<table>
			<caption>Services Overview</caption>
			<tbody>
				<!-- Example #1 -->
				<tr>
					<th colspan="5"><em>Validate returned JSON via GET</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>
				<tr>
					<td><a href="/service/single-user">/service/single-user</a></td>
					<td>GET</td>
					<td>-</td>
					<td>-</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>200</td>
					<td>application/json</td>
					<td colspan="2"><blockquote><pre escaped="true" lang="json">{
  "email":"test@hascode.com",
  "firstName":"Tim",
  "id":"1",
  "lastName":"Testerman"
}</pre></blockquote></td>
				</tr>
				
				<!-- Example #2 -->
				<tr>
					<th colspan="5"><em>Validate returned XML via GET</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>
				<tr>
					<td><a href="/service/single-user">/service/single-user/xml</a></td>
					<td>GET</td>
					<td>-</td>
					<td>-</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>200</td>
					<td>application/xml</td>
					<td colspan="2"><blockquote><pre escaped="true" lang="xml">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;user&gt;
  &lt;email&gt;test@hascode.com&lt;/email&gt;
  &lt;firstName&gt;Tim&lt;/firstName&gt;
  &lt;id&gt;1&lt;/id&gt;
  &lt;lastName&gt;Testerman&lt;/lastName&gt;
&lt;/user&gt;</pre></blockquote></td>
				</tr>
				
				<!-- Example #3 -->
				<tr>
					<th colspan="5"><em>XPath Validation</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>	
				<tr>
					<td><a href="/service/single-user">/service/persons/xml</a></td>
					<td>GET</td>
					<td>-</td>
					<td>-</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>200</td>
					<td>application/xml</td>
					<td colspan="2"><blockquote><pre escaped="true" lang="xml">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;people&gt;
  &lt;person id="1"&gt;
    &lt;email&gt;test@hascode.com&lt;/email&gt;
    &lt;firstName&gt;Tim&lt;/firstName&gt;
    &lt;lastName&gt;Testerman&lt;/lastName&gt;
  &lt;/person&gt;
  &lt;person id="20"&gt;
    &lt;email&gt;dev@hascode.com&lt;/email&gt;
    &lt;firstName&gt;Sara&lt;/firstName&gt;
    &lt;lastName&gt;Stevens&lt;/lastName&gt;
  &lt;/person&gt;
  &lt;person id="11"&gt;
    &lt;email&gt;devnull@hascode.com&lt;/email&gt;
    &lt;firstName&gt;Mark&lt;/firstName&gt;
    &lt;lastName&gt;Mustache&lt;/lastName&gt;
  &lt;/person&gt;
&lt;/people&gt;</pre></blockquote></td>
				</tr>	
				
				<!-- Example #4 -->
				<tr>
					<th colspan="5"><em>Passing Parameters</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>
				<tr>
					<td><a href="/service/user/create">/service/user/create</a></td>
					<td>GET</td>
					<td>-</td>
					<td>Params: email, firstName, lastName</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>200</td>
					<td>application/json</td>
					<td colspan="2"><blockquote><pre escaped="true" lang="xml">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;user&gt;
  &lt;email&gt;test@hascode.com&lt;/email&gt;
  &lt;firstName&gt;Tim&lt;/firstName&gt;
  &lt;id&gt;1&lt;/id&gt;
  &lt;lastName&gt;Testerman&lt;/lastName&gt;
&lt;/user&gt;</pre></blockquote></td>
				</tr>	

				<!-- Example #5 -->
				<tr>
					<th colspan="5"><em>404 - Page Not Found</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>
				<tr>
					<td><a href="/service/status/notfound">/service/status/notfound</a></td>
					<td>GET</td>
					<td>-</td>
					<td>-</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>404</td>
					<td>text/plain</td>
					<td colspan="2">-</td>
				</tr>					

				<!-- Example #6 -->
				<tr>
					<th colspan="5"><em>Basic Authentication</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>
				<tr>
					<td><a href="/service//secure/person">/service//secure/person</a></td>
					<td>GET</td>
					<td>-</td>
					<td>Basic Auth with username=admin and password=admin</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>401 / 200</td>
					<td>text/plain</td>
					<td colspan="2">-</td>
				</tr>	
				
																						<!-- Example #6 -->
				<tr>
					<th colspan="5"><em>HTTP Headers</em></th>
				</tr>
				<tr>
					<td class="type" rowspan="2">Request</td>
					<td class="header">URL</td>
					<td class="header">Method</td>
					<td class="header">Content-Type</td>
					<td class="header">Extras</td>
				</tr>
				<tr>
					<td><a href="/service/header/print">/service/header/print</a></td>
					<td>GET</td>
					<td>-</td>
					<td>Header "myparam"</td>
				</tr>
				<tr>
					<td class="type" rowspan="2">Response</td>
					<td class="header">Status</td>
					<td class="header">Content-Type</td>
					<td colspan="2" class="header">Body/Content</td>
				</tr>
				<tr>
					<td>200</td>
					<td>text/plain</td>
					<td colspan="2">String value of given header param "myparam"</td>
				</tr>				
			</tbody>
		</table>
	</body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.