Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For requesting information from the device to your web site's API, I'd recommend using GET or POST:</p> <p><b>GET</b></p> <pre><code>http://www.example.com/api/v1/getUsers?username=User* </code></pre> <p><b>POST</b></p> <pre><code>http://www.example.com/api/v1/getUsers Post the following information to the above URL: username = User* </code></pre> <p>Regarding responses from the web server, I'd recommend outputting information in either JSON or XML. Android and iOS both have built-in XML parsing libraries, and there are 3rd-party libraries to parse JSON as well. They may even be built-in these days.</p> <p>My recommendation would be to support both JSON and XML, so you can use whichever method best fits the constraints of the development environment you're working with:</p> <p><b>JSON</b></p> <pre><code>{ 'success':True, 'users': [ {'id': 1, 'username': 'User1'}, {'id': 2, 'username': 'User2'}, {'id': 3, 'username': 'User3'} ] } </code></pre> <p><b>XML (utilizing attributes)</b></p> <pre><code>&lt;response&gt; &lt;success&gt;1&lt;/success&gt; &lt;users&gt; &lt;user id="1" username="User1" /&gt; &lt;user id="2" username="User2" /&gt; &lt;user id="3" username="User3" /&gt; &lt;/users&gt; &lt;/response&gt; </code></pre> <p><b>XML (using only tags)</b></p> <pre><code>&lt;response&gt; &lt;success&gt;1&lt;/success&gt; &lt;users&gt; &lt;user&gt; &lt;id&gt;1&lt;/id&gt; &lt;username&gt;User1&lt;/username&gt; &lt;/user&gt; &lt;user&gt; &lt;id&gt;2&lt;/id&gt; &lt;username&gt;User2&lt;/username&gt; &lt;/user&gt; &lt;user&gt; &lt;id&gt;3&lt;/id&gt; &lt;username&gt;User3&lt;/username&gt; &lt;/user&gt; &lt;/users&gt; &lt;/response&gt; </code></pre> <p>In PHP, you can output JSON in the following manner:</p> <pre><code>&lt;?php $response = array( 'success': True, 'users': array( array('id' =&gt; 1, 'username' =&gt; 'User1'), array('id' =&gt; 2, 'username' =&gt; 'User2'), array('id' =&gt; 3, 'username' =&gt; 'User3') ) ) print json_encode($response); </code></pre> <p>Outputting XML is a little more complicated depending on whether or not you want to utilize tag attributes or not...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload