@@ -14,15 +14,7 @@ Authentication and authorization
14
14
--------------------------------
15
15
16
16
Requests to the Read the Docs public API are for public and private information.
17
- Some listing endpoints and some detailed ones are allowed to access without being authenticated.
18
- Although, all endpoints that perform non-readonly operations, require authentication.
19
-
20
-
21
- No authentication
22
- ~~~~~~~~~~~~~~~~~
23
-
24
- Some endpoints on read-only requests won't require any kind of authentication.
25
- Most of them are detailed information of specific listings for a particular object.
17
+ All endpoints require authentication.
26
18
27
19
28
20
Token
@@ -35,6 +27,10 @@ and have the same permissions that the user itself.
35
27
Session
36
28
~~~~~~~
37
29
30
+ .. warning ::
31
+
32
+ Authentication via session is not enabled yet.
33
+
38
34
Session authentication is allowed on very specific endpoints,
39
35
to allow hitting the API when reading documentation.
40
36
@@ -77,13 +73,16 @@ Projects list
77
73
:>json string previous: URI for previous set of projects.
78
74
:>json array results: array of ``project `` objects.
79
75
80
- :query string privacy_level: one of ``public ``, ``private ``, ``protected ``.
76
+ :query string name: name of the project.
77
+ :query string name__contains: part of the name of the project.
78
+ :query string slug: slug of the project.
79
+ :query string slug__contains: part of the slug of the project.
81
80
:query string language: language code as ``en ``, ``es ``, ``ru ``, etc.
81
+ :query string privacy_level: one of ``public ``, ``private ``, ``protected ``.
82
82
:query string programming_language: programming language code as ``py ``, ``js ``, etc.
83
- :query string repository_url: URL of the repository.
84
83
:query string repository_type: one of ``git ``, ``hg ``, ``bzr ``, ``svn ``.
85
84
86
- :requestheader Authorization: required token to authenticate.
85
+ :requestheader Authorization: token to authenticate.
87
86
88
87
89
88
Project details
@@ -97,7 +96,7 @@ Project details
97
96
98
97
.. sourcecode :: bash
99
98
100
- $ curl https://readthedocs.org/api/v3/projects/pip/
99
+ $ curl -H "Authorization: Token <token>" https://readthedocs.org/api/v3/projects/pip/
101
100
102
101
**Example response **:
103
102
@@ -168,9 +167,7 @@ Project details
168
167
169
168
.. TODO: complete the returned data docs once agreed on this.
170
169
171
- :query boolean inactive_versions: whether or not include inactive versions.
172
-
173
- :requestheader Authorization: optional token to authenticate.
170
+ :requestheader Authorization: token to authenticate.
174
171
175
172
:statuscode 200: Success
176
173
:statuscode 404: There is no ``Project `` with this slug
@@ -199,7 +196,7 @@ Versions listing
199
196
200
197
.. sourcecode :: bash
201
198
202
- $ curl https://readthedocs.org/api/v3/projects/pip/versions/
199
+ $ curl -H "Authorization: Token <token>" https://readthedocs.org/api/v3/projects/pip/versions/
203
200
204
201
**Example response **:
205
202
@@ -225,7 +222,7 @@ Versions listing
225
222
:query boolean active: whether return active versions only
226
223
:query boolean built: whether return only built version
227
224
228
- :requestheader Authorization: optional token to authenticate.
225
+ :requestheader Authorization: token to authenticate.
229
226
230
227
231
228
Version detail
@@ -239,7 +236,7 @@ Version detail
239
236
240
237
.. sourcecode :: bash
241
238
242
- $ curl https://readthedocs.org/api/v3/projects/pip/versions/stable/
239
+ $ curl -H "Authorization: Token <token>" https://readthedocs.org/api/v3/projects/pip/versions/stable/
243
240
244
241
**Example response **:
245
242
@@ -287,7 +284,7 @@ Version detail
287
284
:>json string last_build: Build object representing the last build of this version
288
285
:>json array downloads: URLs to downloads of this version's documentation
289
286
290
- :requestheader Authorization: optional token to authenticate.
287
+ :requestheader Authorization: token to authenticate.
291
288
292
289
:statuscode 200: Success
293
290
:statuscode 404: There is no ``Version `` with this slug for this project
@@ -309,11 +306,7 @@ Version edit
309
306
"privacy_level": "public"
310
307
}
311
308
312
- **Example response **:
313
-
314
- `See Version details <#version-detail >`_
315
-
316
- :requestheader Authorization: required token to authenticate.
309
+ :requestheader Authorization: token to authenticate.
317
310
318
311
:statuscode 204: Edited sucessfully
319
312
:statuscode 400: Some field is invalid
@@ -344,7 +337,7 @@ Build details
344
337
345
338
.. sourcecode :: bash
346
339
347
- $ curl https://readthedocs.org/api/v3/projects/pip/builds/8592686/?include_config=true
340
+ $ curl -H "Authorization: Token <token>" https://readthedocs.org/api/v3/projects/pip/builds/8592686/?expand=config
348
341
349
342
**Example response **:
350
343
@@ -422,29 +415,12 @@ Build details
422
415
423
416
:query boolean include_config: whether or not include the configs used for this build. Default is ``false ``
424
417
425
- :requestheader Authorization: optional token to authenticate.
418
+ :requestheader Authorization: token to authenticate.
426
419
427
420
:statuscode 200: Success
428
421
:statuscode 404: There is no ``Build `` with this ID
429
422
430
423
431
- .. http :get :: /api/v3/projects/(str:project_slug)/builds/latest/
432
-
433
- Retrieve details for latest build on this project.
434
-
435
- **Example request **:
436
-
437
- .. sourcecode :: bash
438
-
439
- $ curl https://readthedocs.org/api/v3/projects/pip/builds/latest/
440
-
441
- **Example response **:
442
-
443
- `See Build details <#build-details >`_
444
-
445
- :requestheader Authorization: optional token to authenticate.
446
-
447
-
448
424
Builds listing
449
425
++++++++++++++
450
426
@@ -472,102 +448,28 @@ Builds listing
472
448
:query string commit: commit hash to filter the builds returned by commit
473
449
:query boolean running: whether or not to filter the builds returned by currently building
474
450
475
- :requestheader Authorization: optional token to authenticate.
451
+ :requestheader Authorization: token to authenticate.
476
452
477
453
478
454
Build triggering
479
455
++++++++++++++++
480
456
481
457
482
- .. http :post :: /api/v3/projects/(string:project_slug)/builds/
483
-
484
- Trigger a new build for this project.
485
-
486
- **Example request **:
487
-
488
- .. sourcecode :: json
458
+ .. http :post :: /api/v3/projects/(string:project_slug)/versions/(string:version_slug)/builds/
489
459
490
- {
491
- "version": "latest",
492
- }
460
+ Trigger a new build for the ``version_slug `` version of this project.
493
461
494
462
**Example response **:
495
463
496
464
`See Build details <#build-details >`_
497
465
498
- :requestheader Authorization: required token to authenticate.
466
+ :requestheader Authorization: token to authenticate.
499
467
500
- :statuscode 201: Created sucessfully
468
+ :statuscode 202: Accepted
501
469
:statuscode 400: Some field is invalid
502
470
:statuscode 401: Not valid permissions
503
471
504
472
505
- Build commands listing
506
- ++++++++++++++++++++++
507
-
508
- .. http :get :: /api/v3/projects/(str:project_slug)/builds/(int:build_id)/commands/
509
-
510
- Retrieve build command list of a single build.
511
-
512
- **Example request **:
513
-
514
- .. sourcecode :: bash
515
-
516
- $ curl https://readthedocs.org/api/v3/projects/pip/builds/719263915/commands/
517
-
518
- **Example response **:
519
-
520
- .. sourcecode :: json
521
-
522
- {
523
- "count": 15,
524
- "next": "/api/v3/projects/pip/builds/719263915/commands/?limit=10&offset=10",
525
- "previous": null,
526
- "results": ["BUILDCOMMAND"]
527
- }
528
-
529
- :requestheader Authorization: optional token to authenticate.
530
-
531
-
532
- Build command details
533
- +++++++++++++++++++++
534
-
535
- .. http :get :: /api/v3/projects/(str:project_slug)/builds/(int:build_id)/commands/(int:buildcommand_id)
536
-
537
- Retrieve build command detail.
538
-
539
- **Example request **:
540
-
541
- .. sourcecode :: bash
542
-
543
- $ curl https://readthedocs.org/api/v3/projects/pip/builds/719263915/commands/9182639172/
544
-
545
- **Example response **:
546
-
547
- .. sourcecode :: json
548
-
549
- {
550
- "id": 9182639172,
551
- "build": 719263915,
552
- "project": "pip",
553
- "version": "stable",
554
- "created": "2018-06-19T15:15:59+00:00",
555
- "finished": "2018-06-19T15:16:58+00:00",
556
- "duration": 59,
557
- "command": "cat docs/config.py",
558
- "output": "...",
559
- "exit_code": 0,
560
- "links": {
561
- "self": "/api/v3/projects/pip/builds/719263915/commands/9182639172/",
562
- "build": "/api/v3/projects/pip/builds/719263915/",
563
- "version": "/api/v3/projects/pip/versions/stable/",
564
- "project": "/api/v3/projects/pip/"
565
- }
566
- }
567
-
568
- :requestheader Authorization: optional token to authenticate.
569
-
570
-
571
473
Users
572
474
~~~~~
573
475
@@ -590,36 +492,16 @@ User detail
590
492
.. sourcecode :: json
591
493
592
494
{
593
- "id": 25,
594
495
"username": "humitos",
595
496
"created": "2008-10-23T18:12:31+00:00",
596
- "last_login": "2010-10-23T18:12:31+00:00",
597
- "first_name": "Manuel",
598
- "last_name": "Kaufmann",
599
-
600
- "links": {
601
- "self": "/api/v3/users/humitos/",
602
- "projects": "/api/v3/projects/?user=humitos"
603
- }
497
+ "last_login": "2010-10-23T18:12:31+00:00"
604
498
}
605
499
606
- .. TODO: considering that ``/api/v3/projects/`` will return only
607
- the projects for the authenticated user, the ``projects`` link
608
- here won't work.
609
-
610
- On the other hand, ``/api/v3/projects/all/?user=humitos`` can't
611
- be used because we will be mixing ``all`` as project slug with
612
- our endpoint URL.
613
-
614
- :>json integer id: ID for the user on the database.
615
500
:>json string username: username for the user.
616
501
:>json string created: date and time when the user was created.
617
502
:>json string last_login: date and time for last time this user was logged in.
618
- :>json string first_name: first name of the user.
619
- :>json string last_name: last name of the user.
620
- :>json string email: email of the user.
621
503
622
- :requestheader Authorization: required token to authenticate.
504
+ :requestheader Authorization: token to authenticate.
623
505
624
506
625
507
User listing
@@ -652,7 +534,7 @@ User listing
652
534
:>json string previous: URI for previous set of users.
653
535
:>json array results: array of ``user `` objects.
654
536
655
- :requestheader Authorization: optional token to authenticate.
537
+ :requestheader Authorization: token to authenticate.
656
538
657
539
658
540
Subprojects
@@ -688,7 +570,7 @@ Subprojects listing
688
570
:>json string previous: URI for previous set of projects.
689
571
:>json array results: array of ``project `` objects.
690
572
691
- :requestheader Authorization: required token to authenticate.
573
+ :requestheader Authorization: token to authenticate.
692
574
693
575
694
576
Translations
@@ -724,4 +606,4 @@ Translations listing
724
606
:>json string previous: URI for previous set of projects.
725
607
:>json array results: array of ``project `` objects.
726
608
727
- :requestheader Authorization: required token to authenticate.
609
+ :requestheader Authorization: token to authenticate.
0 commit comments