tobami/codespeed — pull request #101 by a8 (2011-12-15 12:46:52+00:00)
Title: RESTful API chunk

Hi,

# Purpose
I was working on the REST api using [django-tasypie](/toastdriven/django-tastypie). It is not finished yet, far from production ready. Most importantly, it has no authentication enabled for now - Thus, disable it if you use Codespeed on the Internet. To do so, comment out api in [codespeed.urls](/a8/codespeed-a8/blob/master/codespeed/urls.py#L37).

I hope this pull request generates some discussion. It's my first Tastypie REST api added to a project later. I'm happy to fix/adjust things as required.

I use django-tastypie==0.9.10.

# What is working

## Models
All [codespeed.models]() are served by tastypie. Note, DB relations are not resolved by default. So far that is only implemented for the [ExecutableResource](https://github.com/a8/codespeed-a8/blob/add_api/codespeed/api.py#L94).

## Benchmark Results
Single Results can be uploaded employing all the test that are done using add_result(). See the [ResultBundleResource](/a8/codespeed-a8/blob/add_api/codespeed/api.py#L327) and [ResultBundle](https://github.com/a8/codespeed-a8/blob/add_api/codespeed/api.py#L136). Note, the user attribute is for later use.

## User
For authentication and authorization we will need users. There is a [test](/a8/codespeed-a8/blob/add_api/codespeed/tests/tests_api.py#L243) for api key auth. Later on we will need users in codespeed, I guess. I suggest to add attributes to the models.Result to keep track who uploaded which results. I will implement that later.

#What is not working?
## Authentication and Authorization
Tastypie supports among others api key auth. That will be implemented soon. For now be aware, that the api has the Tastypie standard authorization. That means all is read-only.