Skip to content

Commit f7e168f

Browse files
committed
Remove redundant documentation and make it cleaner
Just mention relevant fields (not obvious ones) and status codes.
1 parent 630cf84 commit f7e168f

File tree

1 file changed

+41
-108
lines changed

1 file changed

+41
-108
lines changed

docs/api/v3.rst

+41-108
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ When a user is trying to authenticate via session,
4747
Resources
4848
---------
4949

50+
This section shows all the resources that are currently available in APIv3.
51+
There are some URL attributes that applies to all of these resources:
52+
53+
:?fields=:
54+
55+
Specify which fields are going to be returned in the response.
56+
57+
:?omit=:
58+
59+
Specify which fields are going to be omitted from the response.
60+
61+
:?expand=:
62+
63+
Some resources allow to expand/add extra fields on their responses (see _`Project details` for example).
64+
65+
5066
Projects
5167
~~~~~~~~
5268

@@ -74,21 +90,8 @@ Projects list
7490
"results": ["PROJECT"]
7591
}
7692

77-
:>json integer count: total number of projects.
78-
:>json string next: URI for next set of projects.
79-
:>json string previous: URI for previous set of projects.
80-
:>json array results: array of ``project`` objects.
81-
82-
:query string name: name of the project.
83-
:query string name__contains: part of the name of the project.
84-
:query string slug: slug of the project.
85-
:query string slug__contains: part of the slug of the project.
8693
:query string language: language code as ``en``, ``es``, ``ru``, etc.
87-
:query string privacy_level: one of ``public``, ``private``, ``protected``.
8894
:query string programming_language: programming language code as ``py``, ``js``, etc.
89-
:query string repository_type: one of ``git``, ``hg``, ``bzr``, ``svn``.
90-
91-
:requestheader Authorization: token to authenticate.
9295

9396

9497
Project details
@@ -166,23 +169,17 @@ Project details
166169
}
167170
}
168171

169-
:>json string name: The name of the project.
170-
:>json string slug: The project slug (used in the URL).
171-
172-
.. TODO: complete the returned data docs once agreed on this.
173-
174-
:requestheader Authorization: token to authenticate.
175-
176-
:statuscode 200: Success
177-
:statuscode 404: There is no ``Project`` with this slug
172+
:query string expand: allows to add/expand some extra fields in the response.
173+
Allowed values are ``active_versions``, ``active_versions.last_build`` and
174+
``active_versions.last_build.config``. Multiple fields can be passed separated by commas.
178175

179176

180177
Project create
181178
++++++++++++++
182179

183180
.. http:post:: /api/v3/projects/
184181
185-
Import a project into Read the Docs.
182+
Import a project under authenticated user.
186183

187184
**Example request**:
188185

@@ -213,11 +210,6 @@ Project create
213210

214211
`See Project details <#project-details>`_
215212

216-
:requestheader Authorization: token to authenticate.
217-
218-
:statuscode 201: Created
219-
:statuscode 400: Some field is invalid
220-
221213

222214
Versions
223215
~~~~~~~~
@@ -255,17 +247,8 @@ Versions listing
255247
"results": ["VERSION"]
256248
}
257249

258-
:>json integer count: Total number of Projects.
259-
:>json string next: URI for next set of Projects.
260-
:>json string previous: URI for previous set of Projects.
261-
:>json array results: Array of ``Version`` objects.
262-
263-
:query integer limit: limit number of object returned
264-
:query integer offset: offset from the whole list returned
265-
:query boolean active: whether return active versions only
266-
:query boolean built: whether return only built version
267-
268-
:requestheader Authorization: token to authenticate.
250+
:query boolean active: return active versions only
251+
:query boolean built: return only built version
269252

270253

271254
Version detail
@@ -312,21 +295,16 @@ Version detail
312295
}
313296
}
314297

315-
:>json integer id: ID for this version on the database
316-
:>json string slug: The slug for this version
317-
:>json string verbose_name: The name of the version
318-
:>json string identifier: A version control identifier for this version (eg. the commit hash of the tag)
319-
:>json string ref: tag or branch pointed by this version (available only when version is ``stable`` or ``latest``)
320-
:>json string built: Whether this version has been built
321-
:>json string active: Whether this version is active
322-
:>json string type: The type of this version (typically "tag" or "branch")
323-
:>json string last_build: Build object representing the last build of this version
324-
:>json array downloads: URLs to downloads of this version's documentation
325298

326-
:requestheader Authorization: token to authenticate.
299+
:>json string ref: the version slug where the ``stable`` version points to.
300+
``null`` when it's not the stable version.
301+
:>json string build: the version has at least one successful build.
302+
:>json string uploaded: the version was uploaded manually.
303+
327304

328-
:statuscode 200: Success
329-
:statuscode 404: There is no ``Version`` with this slug for this project
305+
:query string expand: allows to add/expand some extra fields in the response.
306+
Allowed values are ``last_build`` and ``last_build.config``.
307+
Multiple fields can be passed separated by commas.
330308

331309

332310
Version update
@@ -347,10 +325,7 @@ Version update
347325

348326
:requestheader Authorization: token to authenticate.
349327

350-
:statuscode 204: Edited successfully
351-
:statuscode 400: Some field is invalid
352-
:statuscode 401: Not valid permissions
353-
:statuscode 404: There is no ``Version`` with this slug for this project
328+
:statuscode 204: Updated successfully
354329

355330

356331
Builds
@@ -440,22 +415,14 @@ Build details
440415
}
441416
}
442417

443-
:>json integer id: The ID of the build
444-
:>json string date: The ISO-8601 datetime of the build.
418+
:>json string created: The ISO-8601 datetime when the build was created.
419+
:>json string finished: The ISO-8601 datetime when the build has finished.
445420
:>json integer duration: The length of the build in seconds.
446421
:>json string state: The state of the build (one of ``triggered``, ``building``, ``installing``, ``cloning``, or ``finished``)
447-
:>json boolean success: Whether the build was successful
448422
:>json string error: An error message if the build was unsuccessful
449-
:>json string commit: A version control identifier for this build (eg. the commit hash)
450-
:>json string builder: The hostname server that built the docs
451-
:>json string cold_storage: Whether the build was removed from database and stored externally
452423

453-
:query boolean include_config: whether or not include the configs used for this build. Default is ``false``
454-
455-
:requestheader Authorization: token to authenticate.
456-
457-
:statuscode 200: Success
458-
:statuscode 404: There is no ``Build`` with this ID
424+
:query string expand: allows to add/expand some extra fields in the response.
425+
Allowed value is ``config``.
459426

460427

461428
Builds listing
@@ -483,9 +450,7 @@ Builds listing
483450
}
484451

485452
:query string commit: commit hash to filter the builds returned by commit
486-
:query boolean running: whether or not to filter the builds returned by currently building
487-
488-
:requestheader Authorization: token to authenticate.
453+
:query boolean running: filter the builds that are currently building/running
489454

490455

491456
Build triggering
@@ -508,11 +473,7 @@ Build triggering
508473

509474
`See Build details <#build-details>`_
510475

511-
:requestheader Authorization: token to authenticate.
512-
513-
:statuscode 202: Accepted
514-
:statuscode 400: Some field is invalid
515-
:statuscode 401: Not valid permissions
476+
:statuscode 202: the build was triggered
516477

517478

518479
Subprojects
@@ -549,13 +510,6 @@ Subprojects listing
549510
"results": ["PROJECT"]
550511
}
551512

552-
:>json integer count: total number of projects.
553-
:>json string next: URI for next set of projects.
554-
:>json string previous: URI for previous set of projects.
555-
:>json array results: array of ``project`` objects.
556-
557-
:requestheader Authorization: token to authenticate.
558-
559513

560514
Translations
561515
~~~~~~~~~~~~
@@ -588,13 +542,6 @@ Translations listing
588542
"results": ["PROJECT"]
589543
}
590544

591-
:>json integer count: total number of projects.
592-
:>json string next: URI for next set of projects.
593-
:>json string previous: URI for previous set of projects.
594-
:>json array results: array of ``project`` objects.
595-
596-
:requestheader Authorization: token to authenticate.
597-
598545

599546
Redirects
600547
~~~~~~~~~
@@ -690,10 +637,7 @@ Redirect create
690637

691638
`See Redirect details <#redirect-details>`_
692639

693-
:requestheader Authorization: token to authenticate.
694-
695-
:statuscode 201: Created
696-
:statuscode 400: Some field is invalid
640+
:statuscode 201: redirect created successfully
697641

698642

699643
Redirect update
@@ -727,12 +671,6 @@ Redirect update
727671

728672
`See Redirect details <#redirect-details>`_
729673

730-
:requestheader Authorization: token to authenticate.
731-
732-
:statuscode 200: Success
733-
:statuscode 400: Some field is invalid
734-
735-
736674
Redirect delete
737675
++++++++++++++++
738676

@@ -748,9 +686,7 @@ Redirect delete
748686
-X DELETE \
749687
-H "Authorization: Token <token>" https://readthedocs.org/api/v3/projects/pip/redirects/1/
750688

751-
:requestheader Authorization: token to authenticate.
752-
753-
:statuscode 204: Deleted successfully
689+
:statuscode 204: Redirect deleted successfully
754690

755691

756692
Environment Variables
@@ -845,10 +781,7 @@ Environment Variable create
845781

846782
`See Environment Variable details <#environmentvariable-details>`_
847783

848-
:requestheader Authorization: token to authenticate.
849-
850-
:statuscode 201: Created
851-
:statuscode 400: Some field is invalid
784+
:statuscode 201: Environment variable created successfully
852785

853786

854787
Environment Variable delete
@@ -868,4 +801,4 @@ Environment Variable delete
868801

869802
:requestheader Authorization: token to authenticate.
870803

871-
:statuscode 204: Deleted successfully
804+
:statuscode 204: Environment variable deleted successfully

0 commit comments

Comments
 (0)