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: ccdbc50238ad7a2b64046d7e72cc0e96956d061d (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

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/comments/1`
```bash
curl -u username:password \
  -X GET https://nextcloud.local/index.php/apps/polls/api/1.0/comments/1
```

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`

```json
[
    {
        "pollId": 2,
    },

]
```

This will return all comments from poll no. 2

```json
[
    {
        "token": "X3jXHb8WHLMb9MRg",
    },

]
```

This returns all comments from the poll which can be called with the token "X3jXHb8WHLMb9MRg"


# Comments
## Get comments
### Get all Comments by poll as a nextcloud user
GET `/index.php/apps/polls/api/1.0/comments/{pollId}`

### Post a comment
POST `/index.php/apps/polls/api/1.0/comments`

Body
```json
[
    {
        "message": "Comment text",
        "pollId": 1,
        "token": "users's personal token"
    },

]
```

DELETE `/index.php/apps/polls/api/1.0/comments/{commentId}`

Body
```json
[
    {
		"commentId": 123,
		"token": "users's personal token"
    },

]
```

### Returns an array of Comment objects
```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"
    }, ...

]
```