-
Notifications
You must be signed in to change notification settings - Fork 1
Discussions
Endpoint for handling discussions.
| Command | Method | Route | Description |
|---|---|---|---|
| List | GET | /{culture}/api/Discussion | Fetches lists of discussion with selected pagination filter. |
Call to this API method will retrive a list of discussion. Response is paginated:
- its default page size is 10 and cannot be higher than 25
- default page number is 1 and cannot be lower than 1 These can be changed in request.
User can parametrize request:
- PageNumber (default: 1) - will returns chosen page number, i.e.
en-US/api/Discussion?PageNumber=2 - PageSize (default: 10) - will set size of page of response, i.e.
en-US/api/Discussion?PageSize=4
Response data will be in the following format:
{
"data": [
{
"id": <guid>,
"title": <string>,
"description": <string>,
"isPinned": <bool>,
"isClosed": <bool>,
"createdBy": "<string>,
"created": "2021-01-15T09:52:17.879Z",
"lastModifiedBy": <string>,
"lastModified": "2021-01-15T09:52:17.879Z",
"numberOfPosts": <int>,
"posts": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"body": <string>,
"isPinned": <bool>,
"createdBy": <string>,
"created": "2021-01-15T10:39:54.874Z",
"lastModifiedBy": <string>,
"lastModified": "2021-01-15T10:39:54.874Z"
}
]
}
],
"succeeded": <bool>,
"errors": [
<string>
],
"message": <string>,
"pageNumber": <int>,
"pageSize": <int>,
"firstPage": <string>,
"lastPage": <string>,
"totalPages": <int>,
"totalRecords": <int>,
"nextPage": <string>,
"previousPage": <string>
}
Example response for en-US/api/Discussions?PageNumber=2&PageSize=3:
{
"pageNumber": 2,
"pageSize": 3,
"firstPage": "https://localhost:44324/en-US/api/Discussions?pageNumber=1&pageSize=3",
"lastPage": "https://localhost:44324/en-US/api/Discussions?pageNumber=2&pageSize=3",
"totalPages": 2,
"totalRecords": 4,
"nextPage": null,
"previousPage": "https://localhost:44324/en-US/api/Discussions?pageNumber=1&pageSize=3",
"data": [
{
"id": "dc08ef2d-3445-42d5-9c14-6dd3e5103681",
"title": "Discussion No 3",
"description": "Description of discussion no 3",
"isPinned": false,
"isClosed": false,
"createdBy": "bob",
"created": "2020-12-17T09:11:46.345329",
"lastModifiedBy": null,
"lastModified": null,
"numberOfPosts": 3,
"posts": [
{
"id": "91cddeb0-0b3e-4fd6-aefd-2197866bd96e",
"body": "This is second post for this discussion 3",
"isPinned": false,
"createdBy": "bob",
"created": "2020-12-17T09:11:46.345329",
"lastModifiedBy": null,
"lastModified": null
},
{
"id": "94cbe258-362e-4ddc-bc8b-22265c951a94",
"body": "This is first post for this discussion 3",
"isPinned": false,
"createdBy": "bob",
"created": "2020-12-17T09:11:46.345329",
"lastModifiedBy": null,
"lastModified": null
},
{
"id": "df7bf764-45df-42a6-8193-bef1f96f6e5f",
"body": "This is third post for this discussion 3",
"isPinned": false,
"createdBy": "jane",
"created": "2020-12-17T09:11:46.345326",
"lastModifiedBy": null,
"lastModified": null
}
]
}
],
"succeeded": true,
"errors": null,
"message": null
}| Command | Method | Route | Description |
|---|---|---|---|
| Details | GET | /{culture}/api/Discussions/{id} | Feteches a single discussion by id with releted posts filtered by pagination filter |
Call to this API method will retrive a single discussion with selected id and all corelated posts filtered with use of pagination filter. Response post part is paginated:
- its default page size is 10 and cannot be higher than 25
- default page number is 1 and cannot be lower than 1 These can be changed in request.
User can parametrize request:
- PageNumber (default: 1) - will returns chosen page number, i.e.
en-US/api/Discussion/dc08ef2d-3445-42d5-9c14-6dd3e5103681?PageNumber=2 - PageSize (default: 10) - will set size of page of response, i.e.
en-US/api/Discussion/dc08ef2d-3445-42d5-9c14-6dd3e5103681?PageSize=4Response data will be in the following format:
{
"id": <guid>,
"title": <string>,
"description": <string>,
"isPinned": <bool>,
"isClosed": <bool>,
"createdBy": <string>,
"created": "2021-01-15T11:02:04.636Z",
"lastModifiedBy": <string>,
"lastModified": "2021-01-15T11:02:04.636Z",
"numberOfPosts": <int>,
"posts": {
"pageNumber": <int>,
"pageSize": <int>,
"firstsPage": <string>,
"lastPage": <string>,
"totalPages": <int>,
"totalPosts": <int>,
"nextPage": <string>,
"previousPage": <string>,
"data": [
{
"id": <guid>,
"body": <string>,
"isPinned": <bool>,
"createdBy": <string>,
"created": "2021-01-15T11:02:04.636Z",
"lastModifiedBy": <string>,
"lastModified": "2021-01-15T11:02:04.636Z"
}
]
}
}
Example response for en-US/api/Discussions/dc08ef2d-3445-42d5-9c14-6dd3e5103681?PageNumber=2&PageSize=2:
{
"id": "dc08ef2d-3445-42d5-9c14-6dd3e5103681",
"title": "Discussion No 3",
"description": "Description of discussion no 3",
"isPinned": false,
"isClosed": false,
"createdBy": "bob",
"created": "2020-12-17T09:11:46.345329",
"lastModifiedBy": null,
"lastModified": null,
"numberOfPosts": 3,
"posts": {
"pageNumber": 2,
"pageSize": 2,
"firstsPage": "https://localhost:44324/en-US/api/Discussions/dc08ef2d-3445-42d5-9c14-6dd3e5103681?pageNumber=1&pageSize=2",
"lastPage": "https://localhost:44324/en-US/api/Discussions/dc08ef2d-3445-42d5-9c14-6dd3e5103681?pageNumber=2&pageSize=2",
"totalPages": 2,
"totalPosts": 3,
"nextPage": null,
"previousPage": "https://localhost:44324/en-US/api/Discussions/dc08ef2d-3445-42d5-9c14-6dd3e5103681?pageNumber=1&pageSize=2",
"data": [
{
"id": "df7bf764-45df-42a6-8193-bef1f96f6e5f",
"body": "This is third post for this discussion 3",
"isPinned": false,
"createdBy": "jane",
"created": "2020-12-17T09:11:46.345326",
"lastModifiedBy": null,
"lastModified": null
}
]
}| Command | Method | Route | Description |
|---|---|---|---|
| Create | POST | /{culture}/api/Discussions | Adds a new discussion. |
Call to this API method will result in the creation of a new discussion according to the arguments passed in the request body. The format of the arguments in the request body is JSON.
Request body will be in the following format:
{
"id": <guid>,
"title": <string>,
"description": <string>,
"postBody": <string>
}
The response to this call will return id of newly created discussion:
{
<guid>
}
| Update | Method | Route | Description |
|---|---|---|---|
| Details | PUT | /{culture}/api/Discussions/{id} | Updates an existing discussion selected by id. |
Call to this API method will result in the updating an discussion with selected id. Arguments are passed in the request body. The format of the arguments in the request body is JSON.
Request body will be in the following format:
{
"id": <guid>,
"title": <string>,
"description": <string>,
}
The response to this call will return status code 204 if a discussion was edited correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| Delete | DELETE | /{culture}/api/Discussions/{id} | Deletes a discussion with selected id. |
Call to this API method will result in deleting a discussion with selected id. The response to this call will return status code 204 if article was deleted correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| Close | PUT | /{culture}/api/Discussions/{id}/close | Closes an existing opened discussion selected by id. |
Call to this API method will result in closing a discussion with selected id. The response to this call will return status code 204 if a discussion was closed correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| Open | PUT | /{culture}/api/Discussions/{id}/open | Opens an existing closed discussion selected by id. |
Call to this API method will result in opening a discussion with selected id. The response to this call will return status code 204 if a discussion was opened correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| Pin | PUT | /{culture}/api/Discussions/{id}/pin | Pins an existing discussion selected by id. |
Call to this API method will result in pinning a discussion with selected id. The response to this call will return status code 204 if a discussion was pinned correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| Unpin | PUT | /{culture}/api/Discussions/{id}/unpin | Unpins an existing discussion selected by id. |
Call to this API method will result in unpinning a discussion with selected id. The response to this call will return status code 204 if a discussion was unpinned correctly.