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: c56653a01d2dc388fb727d16e9b00dbe3ad98e3b (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

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

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

### Return HTTP status 200
Response body contains all shares of the poll with {pollId}

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

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

## Add a share
POST `/index.php/apps/polls/api/1.0/share`

Data
```json
{
    "type": "public",
    "pollId": 1
}
```

```json
{
    "type": "group",
    "pollId": 1,
    "userId": "groupId"
}
```

```json
{
    "type": "user",
    "pollId": 1,
    "userId": "userId"
}
```

```json
{
    "type": "email",
    "pollId": 1,
    "userEmail": "user@foo.com"
}
```

```json
{
    "type": "contact",
    "pollId": 1,
    "userId": "Contacts'name",
    "userEmail": "user@foo.com"
}
```


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

## Delete a share
DELETE `/index.php/apps/polls/api/1.0/share/{token}`

### Return HTTP status 200 - OK
Response body contains the deleted share

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

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