forked from Astn/JSON-RPC.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpGetExamples.html
More file actions
96 lines (94 loc) · 5.06 KB
/
HttpGetExamples.html
File metadata and controls
96 lines (94 loc) · 5.06 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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function showResults(obj)
{
document.getElementById('results').src = 'json.rpc?jsonrpc=' + document.getElementById(obj).value;
}
</script>
</head>
<body>
<p>The methods being invoked can be found in TestService.cs</p>
<p>These examples use HTTP GET to make the JsonRpc request. I recommend <a target="_blank" href="http://www.fiddler2.com/fiddler2/">Fiddler2</a> to peek at http traffic. </p>
<p>An example of a get request looks like:</p>
<pre>
/json.rpc?jsonrpc={'method':'internal.echo','params':['Echo%20This'],'id':2}
</pre>
<div>
<div style="float: left;">
<div style="padding-left:50px;">Request:
</div>
<div>
<input type="text" style="width: 600px;" id="ex1" value="{'method':'internal.echo','params':['Echo This'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex1');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex2" value="{'method':'myIp','params':[],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex2');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex3" value="{'method':'myUserAgent','params':[],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex3');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex4" value="{'method':'testDateTime','params':[],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex4');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex5" value="{'method':'testRecursiveClass','params':[],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex5');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex6" value="{'method':'testArbitraryJObject','params':[{'myparam':'myvalue','myOtherParam':7}],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex6');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex7" value="{'method':'testFloat','params':[7.625],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex7');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex8" value="{'method':'testInt','params':[7],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex8');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex9" value="{'method':'testCustomString','params':[{'str':'bye'}],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex9');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex10" value="{'method':'testMultipleParameters','params':['hi',1,1.2,{'str':'bye'}],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex10');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex11" value="{'method':'error1','params':['This throws an exception'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex11');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex12" value="{'method':'error2','params':['This throws a formatted exception'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex12');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex13" value="{'method':'error3','params':['This throws a custom exception'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex13');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex14" value="{'method':'error4','params':['This throws an exception using the JsonRpcContext'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex14');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex15" value="{'method':'RequiresCredentials','params':['GoodPassword'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex15');">jsonrpc</button>
</div>
<div>
<input type="text" style="width: 600px;" id="ex16" value="{'method':'RequiresCredentials','params':['BadPassword'],'id':2}" />
<button type="submit" onclick="javascript:showResults('ex16');">jsonrpc</button>
</div>
</div>
<div>
<div style="padding-left:50px;">Response:</div>
<iframe id="results" style="float: right; width:50%; height: 60%;"></iframe>
</div>
</div>
</body>
</html>