Browse Source

Update docs for REST token support

pjc 6 months ago
parent
commit
109dbd0f68
4 changed files with 92 additions and 32 deletions
  1. 24
    8
      docs/index.md
  2. 66
    0
      docs/meta.md
  3. 2
    2
      docs/torrents.md
  4. 0
    22
      docs/users.md

+ 24
- 8
docs/index.md View File

@@ -1,14 +1,6 @@
1 1
 The JSON API provides an easily parseable interface to [BioTorrents.de](https://biotorrents.de).
2 2
 Please use the navigation menu to find lists of endpoints, their arguments, and example responses.
3 3
 
4
-You must be logged in to use the API.
5
-This is done by sending a POST request to
6
-
7
-`https://biotorrents.de/login.php`
8
-
9
-with `username` and `password`
10
-and storing a cookie to be used to access the rest of the API.
11
-
12 4
 
13 5
 # Introduction
14 6
 
@@ -23,6 +15,10 @@ All the JSON returned is in the form
23 15
   "status": "success",
24 16
   "response": {
25 17
     # data
18
+  },
19
+  "info": {
20
+    "source": "BioTorrents.de",
21
+    "version": 1
26 22
   }
27 23
 }
28 24
 ```
@@ -31,6 +27,26 @@ If the request is invalid, or a problem occurs, the `status` will be `failure`.
31 27
 In this case the value of `response` is `undefined`.
32 28
 
33 29
 
30
+## Bearer token auth
31
+
32
+First, generate a token in your profile security settings and keep it safe.
33
+It's functionally a password and like a password, it can't be recovered later.
34
+Then POST an RFC 6750--compliant bearer token along with each GET api endpoint:
35
+
36
+```sh
37
+curl biotorrents.de/ajax.php?action=index \
38
+  -H "Accept: application/json" \
39
+  -H "Authorization: Bearer {token}"
40
+```
41
+
42
+
43
+## Cookie auth
44
+
45
+Please send a POST request to `https://biotorrents.de/login.php` with `username` and `password`,
46
+or acquire a cookie from a browser session using developer tools.
47
+Then store the cookie and use it to access the rest of the API.
48
+
49
+
34 50
 # Libraries
35 51
 
36 52
 These are the current public projects listed on the

+ 66
- 0
docs/meta.md View File

@@ -199,6 +199,7 @@ Fetch the recent news and blogs.
199 199
 
200 200
 Either `id` or `name` is required.
201 201
 
202
+
202 203
 **Request**
203 204
 
204 205
 `ajax.php?action=wiki`
@@ -225,3 +226,68 @@ Either `id` or `name` is required.
225 226
     }
226 227
 }
227 228
 ```
229
+
230
+
231
+## Ontology
232
+
233
+Fetch a site metadata blueprint.
234
+
235
+
236
+**Request**
237
+
238
+`ajax.php?action=ontology`
239
+
240
+
241
+**Response**
242
+
243
+```json
244
+{
245
+    "status": "success",
246
+    "response": {
247
+        "SEQ": {
248
+            "ID": 1,
249
+            "Name": "Sequences",
250
+            "Icon": "/static/common/bioicons/sequences.png",
251
+            "Platforms": {
252
+                "0": "Complete Genomics",
253
+                "1": "cPAS-BGI/MGI",
254
+                "2": "Helicos",
255
+                "3": "Illumina HiSeq",
256
+                # etc.
257
+            },
258
+            "Formats": {
259
+                "NucleoSeq": {
260
+                    "BAM": {
261
+                        "0": "bam"
262
+                    },
263
+                    "CRAM": {
264
+                        "0": "cram"
265
+                    },
266
+                    "EMBL": {
267
+                        "0": "embl"
268
+                    },
269
+                    # etc.
270
+                "ProtSeq": {
271
+                    "ABI/Sciex": {
272
+                        "0": "t2d",
273
+                        "1": "wiff"
274
+                    },
275
+                    "APML": {
276
+                        "0": "apml"
277
+                    },		    
278
+                    # etc.
279
+                },
280
+		# etc.
281
+            },
282
+            "Description": "For data that's ACGT, ACGU, amino acid letters on disk."
283
+        },
284
+        "GRF": {
285
+            "ID": 2,
286
+            "Name": "Graphs",
287
+            "Icon": "/static/common/bioicons/graphs.png",
288
+            # etc.
289
+        },
290
+        # etc.
291
+    }
292
+}
293
+```

+ 2
- 2
docs/torrents.md View File

@@ -172,10 +172,10 @@ The advanced search options are certain to change in the future.
172 172
 
173 173
 `ajax.php?action=browse`
174 174
 
175
-`&page=` — page to display (default: `1`)
176
-
177 175
 `&searchstr=` — string to search for
178 176
 
177
+`&page=` — page to display (default: `1`)
178
+
179 179
 `taglist`, `tags_type`, `order_by`, `order_way`, `filter_cat`, `freetorrent`, `vanityhouse`, `scene`, `haslog`, `releasetype`, `media`, `format`, `encoding`, `artistname`, `filelist`, `groupname`, `recordlabel`, `cataloguenumber`, `year`, `remastertitle`, `remasteryear`, `remasterrecordlabel`, `remastercataloguenumber` — as in advanced search
180 180
 
181 181
 

+ 0
- 22
docs/users.md View File

@@ -520,25 +520,3 @@ switch ($Type) {
520 520
 
521 521
   # etc.
522 522
 ```
523
-
524
-
525
-## Password validate
526
-
527
-Is your current password acceptable?
528
-
529
-
530
-**Request**
531
-
532
-`ajax.php?action=password_validate`
533
-
534
-
535
-**Response**
536
-
537
-```json
538
-{
539
-    "status": "success",
540
-    "response": {
541
-        "pwValidate": "true"
542
-    }
543
-}
544
-```

Loading…
Cancel
Save