1 <div class="body-wrap" xmlns:ext="http://www.extjs.com"><div class="top-tools"><a class="inner-link" href="#Ext.data.Api-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a> <a class="inner-link" href="#Ext.data.Api-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a> <a class="inner-link" href="#Ext.data.Api-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a> <a class="bookmark" href="../docs/?class=Ext.data.Api"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a> </div><h1>Class <a href="source/Api.html#cls-Ext.data.Api">Ext.data.Api</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext.data</td></tr><tr><td class="label">Defined In:</td><td class="hd-info"><a href="source/Api.html#cls-Ext.data.Api">Api.js</a></td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/Api.html#cls-Ext.data.Api">Api</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr></table><div class="description">Ext.data.Api is a singleton designed to manage the data API including methods
2 for validating a developer's DataProxy API. Defines variables for CRUD actions
3 create, read, update and destroy in addition to a mapping of RESTful HTTP methods
4 GET, POST, PUT and DELETE to CRUD actions.<br><br><i>This class is a singleton and cannot be created directly.</i></div><div class="hr"></div><a id="Ext.data.Api-props"></a><h2>Public Properties</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Property</th><th class="msource-header">Defined By</th></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-actions"></a><b><a href="source/Api.html#prop-Ext.data.Api-actions">actions</a></b> : Object<div class="mdesc"><div class="short">Defined actions corresponding to remote actions:
6 create : 'create', // Text representing the remote-...</div><div class="long">Defined actions corresponding to remote actions:
8 create : <em>'create'</em>, <i>// Text representing the remote-action to create records on server.</i>
9 read : <em>'read'</em>, <i>// Text representing the remote-action to read/load data from server.</i>
10 update : <em>'update'</em>, <i>// Text representing the remote-action to update records on server.</i>
11 destroy : <em>'destroy'</em> <i>// Text representing the remote-action to destroy records on server.</i>
12 }</code></pre></div></div></td><td class="msource">Api</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-restActions"></a><b><a href="source/Api.html#prop-Ext.data.Api-restActions">restActions</a></b> : Object<div class="mdesc"><div class="short">Defined {CRUD action}:{HTTP method} pairs to associate HTTP methods with the
13 corresponding actions for RESTful proxie...</div><div class="long">Defined {CRUD action}:{HTTP method} pairs to associate HTTP methods with the
14 corresponding actions for <a href="output/Ext.data.DataProxy.html#Ext.data.DataProxy-restful" ext:member="restful" ext:cls="Ext.data.DataProxy">RESTful proxies</a>.
16 <pre><code>restActions : {
17 create : <em>'POST'</em>,
18 read : <em>'GET'</em>,
19 update : <em>'PUT'</em>,
20 destroy : <em>'DELETE'</em>
21 },</code></pre></div></div></td><td class="msource">Api</td></tr></tbody></table><a id="Ext.data.Api-methods"></a><h2>Public Methods</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Method</th><th class="msource-header">Defined By</th></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-Response"></a><b><a href="source/Api.html#method-Ext.data.Api-Response">Response</a></b>()
23 void<div class="mdesc"><div class="short">Ext.data.Response
24 Experimental. Do not use directly.</div><div class="long">Ext.data.Response
25 Experimental. Do not use directly.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Api</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-getVerb"></a><b><a href="source/Api.html#method-Ext.data.Api-getVerb">getVerb</a></b>( <code>String name</code> )
27 String||null<div class="mdesc"><div class="short">Returns the actual CRUD action KEY "create", "read", "update" or "destroy" from the supplied action-name. This metho...</div><div class="long">Returns the actual CRUD action KEY "create", "read", "update" or "destroy" from the supplied action-name. This method is used internally and shouldn't generally
28 need to be used directly. The key/value pair of Ext.data.Api.actions will often be identical but this is not necessarily true. A developer can override this naming
29 convention if desired. However, the framework internally calls methods based upon the KEY so a way of retreiving the the words "create", "read", "update" and "destroy" is
30 required. This method will cache discovered KEYS into the private validActions hash.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>name</code> : String<div class="sub-desc">The runtime name of the action.</div></li></ul><strong>Returns:</strong><ul><li><code>String||null</code><div class="sub-desc">returns the action-key, or verb of the user-action or null if invalid.</div></li></ul></div></div></div></td><td class="msource">Api</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-hasUniqueUrl"></a><b><a href="source/Api.html#method-Ext.data.Api-hasUniqueUrl">hasUniqueUrl</a></b>( <code>Ext.data.DataProxy proxy</code>, <code>String verb</code> )
32 Boolean<div class="mdesc"><div class="short">Returns true if the supplied verb upon the supplied proxy points to a unique url in that none of the other api-action...</div><div class="long">Returns true if the supplied verb upon the supplied proxy points to a unique url in that none of the other api-actions
33 point to the same url. The question is important for deciding whether to insert the "xaction" HTTP parameter within an
34 Ajax request. This method is used internally and shouldn't generally need to be called directly.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>proxy</code> : Ext.data.DataProxy<div class="sub-desc"></div></li><li><code>verb</code> : String<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li><code>Boolean</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Api</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-isAction"></a><b><a href="source/Api.html#method-Ext.data.Api-isAction">isAction</a></b>( <code>String action</code> )
36 Boolean<div class="mdesc"><div class="short">Returns true if supplied action-name is a valid API action defined in actions constants</div><div class="long">Returns true if supplied action-name is a valid API action defined in <code><a href="output/Ext.data.Api.html#Ext.data.Api-actions" ext:member="actions" ext:cls="Ext.data.Api">actions</a></code> constants<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>action</code> : String<div class="sub-desc">Action to test for availability.</div></li></ul><strong>Returns:</strong><ul><li><code>Boolean</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Api</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-isValid"></a><b><a href="source/Api.html#method-Ext.data.Api-isValid">isValid</a></b>()
38 String[]|true<div class="mdesc"><div class="short">Returns true if the supplied API is valid; that is, check that all keys match defined actions
39 otherwise returns an ar...</div><div class="long">Returns true if the supplied API is valid; that is, check that all keys match defined actions
40 otherwise returns an array of mistakes.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li><code>String[]|true</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource">Api</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-prepare"></a><b><a href="source/Api.html#method-Ext.data.Api-prepare">prepare</a></b>( <code>Ext.data.DataProxy proxy</code> )
42 void<div class="mdesc"><div class="short">This method is used internally by DataProxy and should not generally need to be used directly.
43 Each action of a DataP...</div><div class="long">This method is used internally by <tt><a href="output/Ext.data.DataProxy.html" ext:cls="Ext.data.DataProxy">DataProxy</a></tt> and should not generally need to be used directly.
44 Each action of a DataProxy api can be initially defined as either a String or an Object. When specified as an object,
45 one can explicitly define the HTTP method (GET|POST) to use for each CRUD action. This method will prepare the supplied API, setting
46 each action to the Object form. If your API-actions do not explicitly define the HTTP method, the "method" configuration-parameter will
47 be used. If the method configuration parameter is not specified, POST will be used.
48 <pre><code><b>new</b> Ext.data.HttpProxy({
49 method: <em>"POST"</em>, <i>// <-- <b>default</b> HTTP method when not specified.</i>
51 create: <em>'create.php'</em>,
52 load: <em>'read.php'</em>,
53 save: <em>'save.php'</em>,
54 destroy: <em>'destroy.php'</em>
58 <i>// Alternatively, one can use the object-form to specify the API</i>
59 <b>new</b> Ext.data.HttpProxy({
61 load: {url: <em>'read.php'</em>, method: <em>'GET'</em>},
62 create: <em>'create.php'</em>,
63 destroy: <em>'destroy.php'</em>,
64 save: <em>'update.php'</em>
66 });</code></pre><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>proxy</code> : Ext.data.DataProxy<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Api</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Api-restify"></a><b><a href="source/Api.html#method-Ext.data.Api-restify">restify</a></b>( <code>Ext.data.DataProxy proxy</code> )
68 void<div class="mdesc"><div class="short">Prepares a supplied Proxy to be RESTful. Sets the HTTP method for each api-action to be one of
69 GET, POST, PUT, DELET...</div><div class="long">Prepares a supplied Proxy to be RESTful. Sets the HTTP method for each api-action to be one of
70 GET, POST, PUT, DELETE according to the defined <a href="output/Ext.data.Api.html#Ext.data.Api-restActions" ext:member="restActions" ext:cls="Ext.data.Api">restActions</a>.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>proxy</code> : Ext.data.DataProxy<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">Api</td></tr></tbody></table><a id="Ext.data.Api-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>