summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2021-05-08 15:32:35 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2021-05-08 20:10:39 +0200
commit33461bde6fecde1bd3a637d1e35bd8d9e2f3993d (patch)
treeeb0e0b605c75958a41ba9c00506541e93984dc90
parent91a3b767a4cb00774438e39b194329a82135158c (diff)
move api files, add disclaimer
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r--documentation/docs/api/api-v1.md (renamed from old-docs/externalapi/Legacy.md)2
-rw-r--r--documentation/docs/api/api-v2.md (renamed from old-docs/externalapi/External-Api.md)44
-rw-r--r--documentation/mkdocs.yml9
3 files changed, 32 insertions, 23 deletions
diff --git a/old-docs/externalapi/Legacy.md b/documentation/docs/api/api-v1.md
index 8afb6f9c7..84bdb476f 100644
--- a/old-docs/externalapi/Legacy.md
+++ b/documentation/docs/api/api-v1.md
@@ -1,4 +1,4 @@
-# External API v1-2 (Legacy)
+# External API v1-2
The **News app 1.2** offers a RESTful API
diff --git a/old-docs/externalapi/External-Api.md b/documentation/docs/api/api-v2.md
index 1848fe5b3..ecc23338c 100644
--- a/old-docs/externalapi/External-Api.md
+++ b/documentation/docs/api/api-v2.md
@@ -1,8 +1,10 @@
# External API v2 (Draft)
+**Disclaimer:** this API has not been fully implemented yet.
+
The **News app** offers a RESTful API which can be used to sync folders, feeds and items. The API also supports [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) which means that you can access the API from your browser using JavaScript.
-In addition, an updater API is exposed which enables API users to run feed updates in parallel using a REST API or ownCloud console API.
+In addition, an updater API is exposed which enables API users to run feed updates in parallel using a REST API or Nextcloud console API.
## Conventions
This document uses the following conventions:
@@ -77,11 +79,11 @@ You have to design your app with these things in mind!:
## Request Format
The base URL for all calls is:
- https://yourowncloud.com/index.php/apps/news/api/v2
+ https://yournextcloud.com/index.php/apps/news/api/v2
Unless an absolute Url is specified, the relative Urls in the Specification are appended to this url. To access the route **/sync** for instance you'd use the following url:
- https://yourowncloud.com/index.php/apps/news/api/v2/sync
+ https://yournextcloud.com/index.php/apps/news/api/v2/sync
The required request headers are:
* **Accept**: application/json
@@ -107,7 +109,7 @@ The request body is either passed in the URL in case of a **GET** request (e.g.:
Check the [API level route](#api-level)
### Authentication
-Because REST is stateless you have to re-send user and password each time you access the API. Therefore running ownCloud **with SSL is highly recommended** otherwise **everyone in your network can log your credentials**.
+Because REST is stateless you have to re-send user and password each time you access the API. Therefore running Nextcloud **with SSL is highly recommended** otherwise **everyone in your network can log your credentials**.
Credentials are passed as an HTTP header using [HTTP basic auth](https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side):
@@ -122,10 +124,10 @@ This authentication/authorization method will be the recommended default until c
**Note**: Even if login cookies are sent back to your client, they will not be considered for authentication.
## Response Format
-The status codes are not always provided by the News app itself, but might also be returned because of ownCloud internal errors.
+The status codes are not always provided by the News app itself, but might also be returned because of Nextcloud internal errors.
-The following status codes can always be returned by ownCloud:
-* **401**: The provided credentials to log into ownCloud are invalid.
+The following status codes can always be returned by Nextcloud:
+* **401**: The provided credentials to log into Nextcloud are invalid.
* **403**: The user is not allowed to access the route. This can happen if for instance of only users in the admin group can access the route and the user is not in it.
* **404**: The route can not be found or the resource does not exist. Can also happen if for instance you are trying to delete a folder which does not exist.
* **5xx**: An internal server error occurred. This can happen if the server is in maintenance mode or because of other reasons.
@@ -166,14 +168,14 @@ Read the following notes carefully to prevent being subject to security exploits
* If you are building a client in JavaScript or are using a link with **target="blank"**, remember to set the **window.opener** property to **null** and/or add a **rel="noreferrer"** to your link to prevent your app from being [target by an XSS attack](https://medium.com/@jitbit/target-blank-the-most-underestimated-vulnerability-ever-96e328301f4c#.wf2ddytbh)
## Syncing
-All routes are given relative to the base API url, e.g.: **/sync** becomes **https://yourowncloud.com/index.php/apps/news/api/v2/sync**
+All routes are given relative to the base API url, e.g.: **/sync** becomes **https://yourNextcloud.com/index.php/apps/news/api/v2/sync**
There are two usecases for syncing:
* **Initial sync**: the user does not have any data at all
* **Syncing local and remote changes**: the user has synced at least once and wants to submit and receive changes
### Initial Sync
-The intial sync happens when a user adds an ownCloud account in your app. In that case you want to download all folders, feeds and unread/starred items. To do this, make the following request:
+The intial sync happens when a user adds an Nextcloud account in your app. In that case you want to download all folders, feeds and unread/starred items. To do this, make the following request:
* **Method**: GET
* **Route**: /sync
@@ -391,7 +393,7 @@ Status codes:
* **200**: Folder was updated successfully
* **400**: Folder update error, check the error object:
* **code**: 1: folder name is empty
-* Other ownCloud errors, see [Response Format](#response-format)
+* Other Nextcloud errors, see [Response Format](#response-format)
In case of an HTTP 200, the changed or already existing folder is returned in full in the response, e.g.:
@@ -455,7 +457,7 @@ The following response is being returned:
Status codes:
* **200**: Feed was deleted successfully
* **404**: Feed with given id was not found, no error object
-* Other ownCloud errors, see [Response Format](#response-format)
+* Other Nextcloud errors, see [Response Format](#response-format)
In case of an HTTP 200, the deleted feed is returned in full in the response, e.g.:
@@ -577,7 +579,7 @@ Status codes:
* **code**: 9: request timed out
* **code**: 10: invalid or missing http basic auth headers
* **code**: 11: not allowed to access the feed (difference here is that the user can be authenticated but not allowed to access the feed)
-* Other ownCloud errors, see [Response Format](#response-format)
+* Other Nextcloud errors, see [Response Format](#response-format)
In case of an HTTP 200, the changed feed is returned in full in the response, e.g.:
@@ -649,7 +651,7 @@ A reduced item only contains the item status:
```
## Updater
-Instead of using the built in, slow cron updater you can use the parallel update API to update feeds. The API can be accessed through REST or ownCloud console API.
+Instead of using the built in, slow cron updater you can use the parallel update API to update feeds. The API can be accessed through REST or Nextcloud console API.
The API should be used in the following way:
@@ -658,17 +660,17 @@ The API should be used in the following way:
* For each feed and user id, run the update
* Clean up after the update
-The reference [implementation in Python](https://github.com/owncloud/news-updater) should give you a good idea how to design your own updater.
+The reference [implementation in Python](https://github.com/nextcloud/news-updater) should give you a good idea how to design your own updater.
If the REST API is used, Authorization is required via Basic Auth and the user needs to be in the admin group.
-If the ownCloud console API is used, no authorization is required.
+If the Nextcloud console API is used, no authorization is required.
### Clean Up Before Update
This is used to clean up the database. It deletes folders and feeds that are marked for deletion.
**Console API**:
- php -f /path/to/owncloud/occ news:updater:before-update
+ php -f /path/to/nextcloud/occ news:updater:before-update
**REST API**:
@@ -681,7 +683,7 @@ This call returns pairs of feed ids and user ids.
**Console API**:
- php -f /path/to/owncloud/occ news:updater:all-feeds
+ php -f /path/to/nextcloud/occ news:updater:all-feeds
**REST API**:
@@ -710,7 +712,7 @@ After all feed ids and user ids are known, feeds can be updated in parallel.
* **{userId}**: the user's id
- php -f /path/to/owncloud/occ news:updater:update-feed {feedId} {userId}
+ php -f /path/to/nextcloud/occ news:updater:update-feed {feedId} {userId}
**REST API**:
@@ -727,7 +729,7 @@ This is used to clean up the database. It removes old read articles which are no
**Console API**:
- php -f /path/to/owncloud/occ news:updater:after-update
+ php -f /path/to/nextcloud/occ news:updater:after-update
**REST API**:
@@ -783,7 +785,7 @@ The attributes mean the following:
To find out which API levels are supported, make a request to the following route:
* **Method**: GET
-* **Route**: https://yourowncloud.com/index.php/apps/news/api
+* **Route**: https://yournextcloud.com/index.php/apps/news/api
* **Authentication**: none
The following response is being returned:
@@ -804,7 +806,7 @@ In case of an HTTP 200, the supported API levels are returned as JSON, e.g.:
To find out if a user is running an older News version than **8.8.0**, make a request to the following route:
* **Method**: GET
-* **Route**: https://yourowncloud.com/index.php/apps/news/api/v1-2/version
+* **Route**: https://yournextcloud.com/index.php/apps/news/api/v1-2/version
* **Authentication**: [required](#authentication)
Status codes:
diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml
index 2c0f7dd3f..27c36861c 100644
--- a/documentation/mkdocs.yml
+++ b/documentation/mkdocs.yml
@@ -1,3 +1,10 @@
site_name: Nextcloud News APP
repo_url: https://github.com/nextcloud/news
-edit_uri: blob/master/documentation/ \ No newline at end of file
+edit_uri: blob/master/documentation/
+
+nav:
+ - index.md
+ - api/api-v1.md
+ - api/api-v2.md
+
+theme: readthedocs \ No newline at end of file