From 06f5eb43cdb55f09f40b79a27570e26f72100a51 Mon Sep 17 00:00:00 2001 From: LongHairedHacker Date: Fri, 12 May 2017 21:54:25 +0200 Subject: [PATCH] Added documentation for json --- json_api.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ roms/models.py | 4 ++- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 json_api.md diff --git a/json_api.md b/json_api.md new file mode 100644 index 0000000..5de5f89 --- /dev/null +++ b/json_api.md @@ -0,0 +1,66 @@ +Request and Responses +===================== + +/roms/json/list/ +---------------- +List all roms and available tags without filtering. + +```json +{ + "filter_tag": "", + "tags": { + "" : "", + "foo": "Foo", + "bar": "Bar" + }, + "roms": { + "" : "", + "2": "Annother Test", + "3": "SuperDuperRom", + "4": "LolRom", + "5": "RoflRom", + "6": "FooRom", + "7": "Annother Test2" + } +} +``` + + +/roms/json/list/< tag slug >/ +------------------------------ +List roms that are tagged with the tag associated to **tag slug**. +Still list *all* available tags. +```json +{ + "filter_tag": "", + "tags": { + "" : "", + "foo": "Foo", + "bar": "Bar" + }, + "roms": { + "" : "", + "6": "FooRom", + "7": "Annother Test2" + } +} +``` + +/roms/json/details/< rom id >/ +------------------------------ +Returns details about rom associated by **rom id**. +```json +{ + "id": 7, + "name": "Annother Test2", + "description": "Lalalala\r\n\r\nBeschreibung, Dinge und anderen Kram\r\n\r\nLadida", + "tags": [ + "Foo", + "Bar" + ], + "low_binary": "/media/roms/1ba99feb-eed9-47c5-b626-2f39ebe8c164.bin", + "high_binary": "/media/roms/594d1c79-87e2-4fec-81b8-76845bf8016b.bin", + "creation_time": "2017-05-12T19:13:20.703Z", + "edit_time": "2017-05-12T19:13:20.746Z" +} +``` diff --git a/roms/models.py b/roms/models.py index 5c78ca3..4a73f35 100644 --- a/roms/models.py +++ b/roms/models.py @@ -43,7 +43,9 @@ class Rom(models.Model): 'description' : self.description, 'tags' : self.tag_list(), 'low_binary' : self.low_binary.url, - 'high_binary' : self.high_binary.url + 'high_binary' : self.high_binary.url, + 'creation_time' : self.creation_time, + 'edit_time' : self.edit_time } return json