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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Raritan PX2/PX3 JSON-RPC API: Curl JSON-RPC Example</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Raritan PX2/PX3 JSON-RPC API
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Curl JSON-RPC Example </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h2>Mechanism</h2>
<p>Curl is a cross-platform command line tool for getting or sending files using URL syntax. The tool can be used for sending out HTTP POST requests to invoke JSON-RPC methods on a Raritan device. The response document is printed on the standard output of Curl. This is a direct way to check out particular objects and their methods.</p>
<p>Authentication credentials must be provided using options of curl or as part of the URL.</p>
<p>In case HTTPS is used as protocol and the certificate installed on the device cannot be validated curl must be instructed to allow insecure connections using the '-k' option.</p>
<p>In order to direct the request to the desired object implementing a particular interface a well-known resource identfier must be used as part of the URL. All well know URIs are defined in file <a href="Well-Known-URIs.txt">Well-Known-URIs.txt</a>. Note that the link points to a file which is specific for one product, EMX or PX.</p>
<h2>Examples</h2>
<p>Note: The output of the examples below has been formatted for readability. JSON objects can be pretty-printed by filtering them through tools like <code>indent</code> or <code>python -mjson.tool</code>.</p>
<h3>Getting device information:</h3>
<p>Code: </p><div class="fragment"><div class="line">curl -skd '{ "jsonrpc": "2.0", "method": "getMetaData", "id": 42 }' \</div><div class="line"> https://admin:raritan@my-py.example.com/model/pdu/0</div></div><!-- fragment --><p>Result: </p><div class="fragment"><div class="line">{</div><div class="line"> "jsonrpc": "2.0",</div><div class="line"> "result": {</div><div class="line"> "_ret_": {</div><div class="line"> "ctrlBoardSerial": "PKI9050003",</div><div class="line"> "fwRevision": "3.0.2.5-41550",</div><div class="line"> "hasLatchingOutletRelays": false,</div><div class="line"> "hasMeteredOutlets": false,</div><div class="line"> "hasSwitchableOutlets": true,</div><div class="line"> "hwRevision": "0x64",</div><div class="line"> "isInlineMeter": false,</div><div class="line"> "macAddress": "00:0d:5d:07:87:5c",</div><div class="line"> "nameplate": {</div><div class="line"> "imageFileURL": "",</div><div class="line"> "manufacturer": "Raritan",</div><div class="line"> "model": "PX2-2630U-A1",</div><div class="line"> "partNumber": "",</div><div class="line"> "rating": {</div><div class="line"> "current": "24A",</div><div class="line"> "frequency": "50/60Hz",</div><div class="line"> "power": "15.0-17.3kVA",</div><div class="line"> "voltage": "360-415V"</div><div class="line"> },</div><div class="line"> "serialNumber": "PKE0954001"</div><div class="line"> }</div><div class="line"> }</div><div class="line"> },</div><div class="line"> "id": 42,</div><div class="line">}</div></div><!-- fragment --><h3>Switching the first outlet:</h3>
<p>Code: </p><div class="fragment"><div class="line">curl -skd '{ "jsonrpc": "2.0", "method": "setPowerState", "params": { "pstate": 1 }, "id": 23 }' \</div><div class="line"> https://admin:raritan@192.168.7.67/model/pdu/0/outlet/0</div></div><!-- fragment --><p>Result: </p><div class="fragment"><div class="line">{</div><div class="line"> "jsonrpc": "2.0",</div><div class="line"> "result": {</div><div class="line"> "_ret_": 0</div><div class="line"> },</div><div class="line"> "id": 23</div><div class="line">}</div></div><!-- fragment --> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Aug 21 2020 10:20:37 for Raritan PX2/PX3 JSON-RPC API by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
|