Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use Tastypie to wrap internal functions
    primarykey
    data
    text
    <p>I have a Django web application, which allows users to do stop/start/install_pkg on a remote server over HTTP from UI. Django web app has start / stop / install_pkg functions already implemented which basically creates the appropriate URL and calls the HTTP url with params.</p> <p>My goal is to use the same internal functions when user does a REST call like the following:</p> <pre><code>1. https://api/v1/server/&lt;server_name&gt;/start/?api_key=&lt;api_key&gt;&amp;params=&lt;params&gt; 2. https://api/v1/server/&lt;server_name&gt;/stop/?api_key=&lt;api_key&gt;&amp;params=&lt;params&gt; 3. https://api/v1/server/&lt;server_name&gt;/install_pkg/?api_key=&lt;api_key&gt;&amp;params=&lt;params&gt; </code></pre> <p>And return JSON response to the caller containing remote server response object. </p> <p>So far I have used Tastypie library to expose read-only access to model data of the Django web app over REST. </p> <p>Tastypie tutorial on <a href="https://django-tastypie.readthedocs.org/en/latest/non_orm_data_sources.html?highlight=non%20orm" rel="nofollow">Non ORM resource</a> shows how to interact with non ORM resources by overriding 9 methods of Tastypie. But given my limited knowledge and understanding I am unclear about how to use Tastypie for my case. Am I missing anything here?</p> <h2>EDITED: (29 Oct 2012)</h2> <p>To clarify further - Django web app has ORM entry for each of the remote servers in but this information is static info about a particular remote server like (name, ip, domain, ...) since it is created at the time of registering the remote server to Django web app. </p> <p>The web service call from the Django web app to the remote server fetches the most current state of the remote server like (app_state, pkg_installed_list, ...) and this data is not getting stored anywhere in my Djnago web app. It is rendered as it is in UI.</p> <p>Thus a GET on Django web app about the remote server essentially returns the static info.</p> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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