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