Files
Facilitor/APPL/API2/TESTER/api2_tester.asp
Alex Tiehuis 72bd4e3601 FCLT#57074 In ASP-code ook FACILITOR-->Facilitor
svn path=/Website/branches/v2019.1/; revision=41773
2019-03-25 12:58:13 +00:00

144 lines
5.9 KiB
Plaintext

<%@ language = "JavaScript" %>
<%
/*
$Revision$
$Id$
*/
ANONYMOUS_Allowed = 1;
%>
<!-- #include file="../../Shared/common.inc" -->
<%
var fac_id = Request.QueryString("fac_id").Count > 0&&String(Request.QueryString("fac_id"))||"";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>API2 Tester</title>
<script src="jquery-1.11.3.min.js"></script>
<script src="tester.js"></script>
<script src="jquery.iecors.js"></script>
<script>
$(document).ready(function()
{
$(doInit);
$(doBuild);
});
var RVT_token = "<%=safe.jsstring(protectRequest.theToken())%>";
</script>
<style>
pre { font-size: 1.2em;
-moz-tab-size:4;
}
td { vertical-align: top;}
th {border-bottom: 1px solid #666;line-height:20px;}
input[type=button],input[type=submit], button {font-weight: bold;}
</style>
</head>
<body style='background-color:#E5EAF1; font-family: Helvetica; font-size: 0.8em;'>
<form method="post" onsubmit="doSubmit();return false;">
<table>
<th colspan="2">Facilitor API2 tester - FOR INTERNAL USE ONLY [ <a href="<%=safe.htmlattr(HTTP.urlzelf())%>/api2/" target="_blank" rel="noopener noreferrer">API reference</a> ]</th>
<tr><td><label>Format</label></td>
<td><input type='radio' id='format' name='format' value='json' checked='1'>json</input>
<input type='radio' id='format' name='format' value='xml'>xml</input>
<input type='radio' id='format' name='format' value='html'>html (formatted json)</input>
<input type='radio' id='format' name='format' value='api'>api</input>
</td>
</tr>
<tr><td><label>fac_id</label></td>
<td><input id="facid" type="text" style="width:100px" value="<%=safe.htmlattr(fac_id)%>">
</td>
</tr>
<tr><td><label>APIKEY</label></td>
<td><input id="apikey" type="text" style="width:250px" value="APIPFO">&nbsp;
<%
if (user_key > 0) { %>
Herkend als: <%= safe.html(user.oslogin()) %>
<% } %>
</td>
</tr>
<tr><td><label>API2</label></td>
<td><select id="api" style="width:250px">
</select>
</td>
</tr>
<tr><td><label>Website</label></td>
<td><input id="urlbase" type="text" style="width:250px" value="<%=safe.htmlattr(HTTP.urlzelf())%>">
</td>
</tr>
<tr><td><label>Scope</label></td>
<td><select id="scope" style="width:50px">
<option></option>
<option>fe</option>
<option>fo</option>
<option>bo</option>
<option>mi</option>
</select>
</td>
</tr>
<tr><td><label>Pretty JSON</label></td>
<td><input id="pretty" type="checkbox" checked='1'>
</td>
</tr>
<tr><td><label>Logging</label></td>
<td><input id="log" type="checkbox" checked='1'></td>
</tr>
<tr><td></td><td><input type="button" onclick="doBuild();" value="Build URL"></td></tr>
<tr><td><label>URL</label></td>
<td><input id="url" type="text" style="width:800px">
<div id="urltest" style="width:800px;color:#888;"></div>
</td>
</tr>
<tr><td><label>Method</label></td>
<td><label><input type='radio' id='method' name='method' value='GET' checked='1'>GET</label>
<label><input type='radio' id='method' name='method' value='PUT'>PUT (update)</label>
<label><input type='radio' id='method' name='method' value='POST'>POST (insert)</label>
<label><input type='radio' id='method' name='method' value='DELETE'>DELETE</label>
</td>
</tr>
<tr><td><label>Request body</label></td>
<td><textarea id="xml" style="height:200px;width:800px">
{
"appointment": {
"id": 3328303,
"from": "2014-06-20T06:00:00Z",
"to": "2014-06-20T18:00:00Z",
"description": "Een test afspraak",
"action": {
"id": 5,
"name": "Op laten halen (bellen)"
},
"visitors": [
{
"id": 5287608,
"name": "Bezoekernaam",
"company": "Bezoekerbedrijf",
"badge": null,
"in": null,
"out": null
}
]
}
}
</textarea>
</td>
</tr>
<tr><td></td><td><input type="submit" onclick="doSubmit();return false;" value="Submit"></td></tr>
</table>
</form>
<table>
<tr><td>Status:</td><td><span id="Status"></span></td></tr>
<tr><td>StatusText:</td><td><span id="StatusText"></span></td></tr>
<tr><td>Duration:</td><td><span id="Duration"></span></td></tr>
<tr><td>Records:</td><td><span id="Records"></span></td></tr>
<tr><td>Size:</td><td><span id="ResultSize"></span></td></tr>
<tr><td>Result:<button onclick='$("#xml").val($("#Result").text())'>^^^</button></td>
<td style='border:1px solid #666;font-size:0.8em;background-color:#fafafa;min-width:800px;'>
<pre id="Result" style="padding:0 8px 0 2px;"></pre>
</td>
</tr>
</table>
</body>
</html>