From df2d0ccada4872d7177b83f34328b08d42502492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Mon, 20 Jun 2016 18:54:45 +0200 Subject: [PATCH] Rename the "website" endpoint to "website-zim". Fix #17 --- README.rst | 33 ++++++++++++-- app/index.html | 2 +- static/index.html | 107 ---------------------------------------------- zimit/views.py | 2 +- 4 files changed, 32 insertions(+), 112 deletions(-) delete mode 100644 static/index.html diff --git a/README.rst b/README.rst index 53de73a..12babe2 100644 --- a/README.rst +++ b/README.rst @@ -11,8 +11,8 @@ Exposed API All APIs are talking JSON over HTTP. As such, all parameters should be sent as stringified JSON and the Content-Type should be set to "application/json". -POST /websites -============== +POST /website-zim +================= By posting to this endpoint, you are asking the system to start a new download of a website and a conversion into a Zim format. @@ -47,6 +47,19 @@ Status codes it contains information about what is missing. - `201 Created` will be returned if the process started. +Exemple +------- + +:: + + $ http POST http://0.0.0.0:6543/website-url url="https://refugeeinfo.eu/" title="Refugee Info" email="alexis@notmyidea.org" + HTTP/1.1 201 Created + + { + "job": "5012abe3-bee2-4dd7-be87-39a88d76035d" + } + + GET /status/{jobid} =================== @@ -65,6 +78,20 @@ Status codes - `404 Not Found` will be returned in case the requested job does not exist. - `200 OK` will be returned in any other case. +Exemple +------- + +:: + + http GET http://0.0.0.0:6543/status/5012abe3-bee2-4dd7-be87-39a88d76035d + HTTP/1.1 200 OK + + { + "log": "", + "status": "finished" + } + + Okay, so how do I install it on my server? ########################################## @@ -92,7 +119,7 @@ In a separate process, you also need to run the worker:: And you're ready to go. To test it:: - $ http POST http://0.0.0.0:6543/website url="https://refugeeinfo.eu/" title="Refugee Info" email="alexis@notmyidea.org" + $ http POST http://0.0.0.0:6543/website-url url="https://refugeeinfo.eu/" title="Refugee Info" email="alexis@notmyidea.org" Debian dependencies diff --git a/app/index.html b/app/index.html index dffef38..d3ca141 100644 --- a/app/index.html +++ b/app/index.html @@ -67,7 +67,7 @@ function submitForm() { title: getField('title'), email: getField('email'), } - fetch("/website", { + fetch("/website-zim", { method: "POST", body: JSON.stringify(content), headers: {'Content-Type': 'application/json'} diff --git a/static/index.html b/static/index.html deleted file mode 100644 index dac806d..0000000 --- a/static/index.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - Zim It! - - - - - - - - - - - -
- - -
-
- -
-
-
- -
- -
- -
- - -
-
-
- - -
-
-
-
- - -
-
- - -
-
-
- -
-
-
- - -
-
- -
-
- - -
-
- - -
-
- -
- -
- - -
-

This is a zim creator. Enter the url of the website you want ton turn in a zim file, a title and the language and click on Create zim File.
If - needed, you can also add a description, the name of the origanl author -of the content and your email if you want to be notified when the zim is - ready. Enjoy !

-
- -
-
-
- -
- -
- - - - diff --git a/zimit/views.py b/zimit/views.py index a2ccc8f..034cb05 100644 --- a/zimit/views.py +++ b/zimit/views.py @@ -6,7 +6,7 @@ from pyramid.httpexceptions import HTTPTemporaryRedirect, HTTPNotFound from zimit.worker import create_zim -website = Service(name='website', path='/website') +website = Service(name='website', path='/website-zim') home = Service(name='home', path='/') status = Service(name='status', path='/status/{id}')