Api Explorer - code cleanup
[civicrm-core.git] / templates / CRM / Admin / Page / APIExplorer.tpl
CommitLineData
0c3a6e64
CW
1
2<style>
3{literal}
4#result {background:lightgrey;}
5#selector a {margin-right:10px;}
6.required {font-weight:bold;}
7.helpmsg {background:yellow;}
8#explorer label {display:inline;}
9code {line-height:1em;}
10{/literal}
11</style>
12
13<body>
14<form id="explorer">
15<label>entity</label>
16<select id="entity" data-id="entity">
17 <option value="" selected="selected">Choose...</option>
18{crmAPI entity="Entity" action="get" var="entities" version=3}
19{foreach from=$entities.values item=entity}
20 <option value="{$entity}">{$entity}</option>
21{/foreach}
22</select>
23&nbsp;|&nbsp;
24
25<label>action</label>
26<select id="action" data-id="action">
27 <option value="" selected="selected">Choose...</option>
28 <option value="get">get</option>
29 <option value="create" title="used to update as well, if id is set">create</option>
30 <option value="delete">delete</option>
31 <option value="getfields">getfields</option>
32 <option value="getactions">getactions</option>
33 <option value="getcount">getcount</option>
34 <option value="getsingle">getsingle</option>
35 <option value="getvalue">getvalue</option>
36 <option value="getoptions">getoptions</option>
37 <option value="getlist">getlist</option>
38</select>
39&nbsp;|&nbsp;
40
41<label for="debug-checkbox">
42 <input type="checkbox" id="debug-checkbox" data-id="debug" checked="checked" value="1">debug
43</label>
44&nbsp;|&nbsp;
45
46<label for="sequential-checkbox" title="{ts}sequential is a more compact format, that is nicer and general and easier to use for json and smarty.{/ts}">
47 <input type="checkbox" id="sequential-checkbox" data-id="sequential" checked="checked" value="1">sequential
48</label>
49&nbsp;|&nbsp;
50
51<label for="json-checkbox">
52 <input type="checkbox" id="json-checkbox" data-id="json" checked="checked" value="1">json
53</label>
54
55<div id="selector"></div>
56<div id="extra"></div>
57<input size="90" maxsize=300 id="query" value="{crmURL p="civicrm/ajax/rest" q="json=1&debug=on&entity=Contact&action=get&sequential=1&return=display_name,email,phone"}"/>
58<input type="submit" value="GO" title="press to run the API query"/>
59<table id="generated" border=1 style="display:none;">
60 <caption>Generated codes for this api call</caption>
61 <tr><td>URL</td><td><div id="link"></div></td></tr>
62 <tr><td>smarty</td><td><code id="smarty" title='smarty syntax (mostly works for get actions)'></code></td></tr>
63 <tr><td>php</td><td><code id="php" title='php syntax'></code></td></tr>
64 <tr><td>javascript</td><td><code id="jQuery" title='javascript syntax'></code></td></tr>
65</table>
66<pre id="result">
67You can choose an entity and an action (eg Tag Get to retrieve a list of the tags)
68Or your can directly modify the url in the field above and press enter.
69
70When you use the create method, it displays the list of existing fields for this entity.
71click on the name of the fields you want to populate, fill the value(s) and press enter
72
73The result of the ajax calls are displayed in this grey area.
74</pre>