REST API 101 – for my presentation for Webcamp KL, May 2013
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
presentation
restapi_talk
.gitignore
README.rst
REST API Demo.ipynb
manage.py
requirements.docs.txt
requirements.txt

README.rst

Rest API 101 - Webcamp KL, May 2013 Code Demo

Installation

  1. Create a virtualenv instance.

    Note

    All commands below are prepended with an expected bash prompt.

    • "$" indicates a normal bash prompt, virtualenv is not activated
    • "(.env)$" indicates a bash prompt with virtualenv activated
    $ virtualenv .env
    $ source .env/bin/activate
    (.env)$
  2. Install the required packages.

    (.env)$ pip install -r requirements.txt
  3. Create the local settings file and configure it to your liking.

    (.env)$ cp restapi_talk/settings/local.example.py restapi_talk/settings/local.py
    (.env)$ vim restapi_talk/settings/local.py
  4. Generate the database file. Follow any on-screen instructions that is shown.

    (.env)$ ./manage.py syncdb && ./manage.py migrate
  5. If needed, you can load up some sample data to get you started:

    (.env)$ ./manage.py loaddata restapi_talk/fundtracking/ixtures/sample_data.json

Demo

The demo page is implemented in iPython Notebook and for you to execute the code samples of accessing the API, here's what you'd need to do:

  1. Start the Django server

    python manage.py runserver
  2. Start the iPython Notebook server

    ipython notebok --pprint
  3. If the iPython Notebook web interface is not loaded on your default web browser, you can access it by visiting http://localhost:8888/

  4. Access the "REST API Demo" notebook and you can execute all codes that are listed there by selecting the cell and click on the "Run Cell" button.

Presentation

The presentation slides are available at presentation/build/slides/index.html. You can also read the slide deck in one page.

If you want to adapt the content, you can follow the steps below:

  1. Install the requirements for documentation generation:

    (.env)$ pip install -r requirements.docs.txt
  2. Edit presentation/source/index.rst, it's a ReStructured Text document.

  3. Once you make the edits, you can generate the new slide show with the following command.

    (.env)$ cd presentation
    (.env)$ make slides

License

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.