Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-06-14 23:42:37 +0300
committerdartcafe <github@dartcafe.de>2020-06-14 23:42:37 +0300
commit464e91b444b6af9f3fa10906cfb32576c87deb8f (patch)
tree35cab631dbbbc5e3fa70a87a7e44288b1b5a8e98 /docs
parent76cba400fc9d8139d1b62fb6e1ce3746368a5574 (diff)
Updated doc
Diffstat (limited to 'docs')
-rw-r--r--docs/API_v1.0.md137
1 files changed, 77 insertions, 60 deletions
diff --git a/docs/API_v1.0.md b/docs/API_v1.0.md
index ccdbc502..4a5843fd 100644
--- a/docs/API_v1.0.md
+++ b/docs/API_v1.0.md
@@ -5,83 +5,100 @@ Parameters in the body override the URL-parameter
Base URL for all calls: /index.php/apps/polls/api/1.0/
Example calls:
* Gets all comments of poll no. 1
-`https://username:password@nextcloud.local/index.php/apps/polls/api/1.0/comments/1`
+`https://username:password@nextcloud.local/index.php/apps/polls/api/1.0/poll/1/comments`
```bash
-curl -u username:password \
- -X GET https://nextcloud.local/index.php/apps/polls/api/1.0/comments/1
+`curl -u username:password -X GET https://nextcloud.local/index.php/apps/polls/api/1.0/poll/1/comments`
```
-You can add a Body with the parameters, which overrides the URL-Parameter
-`https://username:password@nextcloud.local/index.php/apps/polls/api/1.0/comments/1`
+# Comments
+## List all comments by poll
+GET `/index.php/apps/polls/api/1.0/poll/{pollId}/comments`
-```json
-[
- {
- "pollId": 2,
- },
+### Return HTTP status 200
+Response body contains all comments of the poll with {pollId}
-]
-```
+### Return HTTP status 403 - Forbidden
+Authorization is missing use correct username:passwort
-This will return all comments from poll no. 2
+### Return HTTP status 404 - Not found
+commentId not found
-```json
-[
- {
- "token": "X3jXHb8WHLMb9MRg",
- },
+## Post a new comment
+POST `/index.php/apps/polls/api/1.0/comment`
-]
+Data
+```json
+{
+ "message": "Comment text",
+ "pollId": 1,
+}
```
+### Return HTTP status 201 - Created
+Comment successfully created
+Response Body contains the comment as json
-This returns all comments from the poll which can be called with the token "X3jXHb8WHLMb9MRg"
+### Return HTTP status 403 - Forbidden
+Authorization is missing use correct username:passwort
+### Return HTTP status 404 - Not found
+pollId not found
-# Comments
-## Get comments
-### Get all Comments by poll as a nextcloud user
-GET `/index.php/apps/polls/api/1.0/comments/{pollId}`
+## Delete a comment
+DELETE `/index.php/apps/polls/api/1.0/comment/{commentId}`
-### Post a comment
-POST `/index.php/apps/polls/api/1.0/comments`
+### Return HTTP status 200
+Response body contains the commentId
-Body
-```json
-[
- {
- "message": "Comment text",
- "pollId": 1,
- "token": "users's personal token"
- },
-
-]
-```
+### Return HTTP status 403 - Forbidden
+Authorization is missing, use correct username:passwort
-DELETE `/index.php/apps/polls/api/1.0/comments/{commentId}`
+### Return HTTP status 404 - Not found
+commentId not found
-Body
-```json
-[
- {
- "commentId": 123,
- "token": "users's personal token"
- },
+# Options
+## List all options by poll
+GET `/index.php/apps/polls/api/1.0/poll/{pollId}/options`
-]
-```
+### Return HTTP status 200
+Response body contains all options of the poll with {pollId}
-### Returns an array of Comment objects
+### Return HTTP status 403 - Forbidden
+Authorization is missing, use correct username:passwort
+
+### Return HTTP status 404 - Not found
+optionId not found
+
+## Post a new option
+POST `/index.php/apps/polls/api/1.0/option`
+
+Data
```json
-[
- {
- "id": 1,
- "pollId": 1,
- "userId": "Commenter's name",
- "dt": "2020-01-21 14:01:01",
- "timestamp": 1587468691,
- "comment": "message",
- "displayName": "Commenters's display name"
- }, ...
-
-]
+{
+ "message": "Comment text",
+ "pollId": 1,
+}
```
+### Return HTTP status 201 - Created
+Comment successfully created
+Response Body contains the option as json
+
+### Return HTTP status 403 - Forbidden
+Authorization is missing use correct username:passwort
+
+### Return HTTP status 404 - Not found
+pollId not found
+
+### Return HTTP status 409 - Conflict
+The option already exists in this poll
+
+## Delete an option
+DELETE `/index.php/apps/polls/api/1.0/option/{optionId}`
+
+### Return HTTP status 200 - OK
+Response body contains the optionId
+
+### Return HTTP status 403 - Forbidden
+Authorization is missing use correct username:passwort
+
+### Return HTTP status 404 - Not found
+optionId not found