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

API_v1.0.md « docs - github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4a5843fda8c8e3e583f6e96ac49f550ee859b66a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

To act like a authenticated user, use username:password@ prefix in the URL
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/poll/1/comments`
```bash
`curl -u username:password -X GET https://nextcloud.local/index.php/apps/polls/api/1.0/poll/1/comments`
```

# Comments
## List all comments by poll
GET `/index.php/apps/polls/api/1.0/poll/{pollId}/comments`

### 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

### Return HTTP status 404 - Not found
commentId not found

## 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

### Return HTTP status 403 - Forbidden
Authorization is missing use correct username:passwort

### Return HTTP status 404 - Not found
pollId not found

## Delete a comment
DELETE `/index.php/apps/polls/api/1.0/comment/{commentId}`

### Return HTTP status 200
Response body contains the commentId

### Return HTTP status 403 - Forbidden
Authorization is missing, use correct username:passwort

### Return HTTP status 404 - Not found
commentId not found

# 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}

### 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
{
    "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