Skip to main content

Web Article API

The Web Article API allows Web User to manage the articles in the Web Portal.

Endpoints

# Endpoints

Get article districts

This endpoint gets the subcategories of the articles. The subcategory is only needed for category with dist = 1.

Request

GET /web/articles/districts

Response (ArticleDistrictDTO)

{
"success": true,
"message": "",
"data": [
[
{
"type": 3,
"desc": "葵涌安泰軒"
},
{
"type": 4,
"desc": "深水埗安泰軒"
},
{
"type": 5,
"desc": "屯門安泰軒"
},
{
"type": 6,
"desc": "天水圍安泰軒"
},
{
"type": 7,
"desc": "油尖旺安泰軒"
}
]
]
}

Add article tag

This endpoint adds an article tag.

Request (AddArticleTagReqDTO)

POST /web/articles/tags
{
"name": "tag 1"
}

Response

{
"success": true,
"message": "",
"data": null
}

Get article tags

This endpoint adds an article tag.

Request

GET /web/articles/tags

Response (GetArticleTagResDTO)

{
"success": true,
"message": "",
"data": [
{
"id": "60a8fbe7-1059-45ea-9c65-e57c3430803b",
"name": "tag 1"
}
]
}

Delete article tag

This endpoint deletes an article tag.

Request (DeleteArticleTagReqDTO)

DELETE /web/articles/tags
{
"id": "60a8fbe7-1059-45ea-9c65-e57c3430803b",
"name": "tag 1"
}

Response

{
"success": true,
"message": "",
"data": null
}

Add article

This endpoint adds an article.

Request (AddArticleReqDTO)

新增「最新消息」;「純文字」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"registrationLink": "https://www.google.com",
"category": 1,
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"type": 0
}

新增「認識精神健康」;「純文字」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 2,
"subcategory": 1,
"type": 0
}

新增「生命故事分享」;「純文字」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 3,
"type": 0
}

新增「專欄分享」;「純文字」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 0
}

新增「專欄分享」;「多圖片」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 1,
"images": [
{
"fileKey": "temp/5e243d9f-797a-4536-afd0-25669aeb4ca5"
},
{
"fileKey": "temp/0b2455ef-25dc-48eb-920f-a93e94399959"
}
]
}

新增「專欄分享」;「PDF文件」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 2,
"pdf": {
"fileKey": "temp/5e243d9f-797a-4536-afd0-25669aeb4ca5"
}
}

新增「專欄分享」;「影片」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 3,
"videoLink": "https://www.youtube.com/live/FkfEMReEl5g?si=a9Z8z3vGI6773wdB"
}

新增「專欄分享」;「音頻」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 4,
"audio": {
"fileKey": "temp/5e243d9f-797a-4536-afd0-25669aeb4ca5"
}
}

新增「專欄分享」;「自定义标签」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 0,
"tags": [
{
"id": "9d202391-f041-4971-9b77-cc3a38c2819f",
"name": "test 2"
},
{
"id": "e7269538-be93-4258-b7c6-dd5c9f980665",
"name": "test3"
}
]
}

新增「專欄分享」;「上架日期」和「下架日期」

POST /web/articles
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"category": 4,
"type": 0,
"pushTime": "2024-09-21T00:00:00Z",
"pullTime": "2024-10-23T00:00:00Z"
}

Response (ArticleDTO)

{
"success": true,
"message": "",
"data": {
"id": "52e8306d-301b-4985-b9fd-b7b3dd4c43c8",
"canEdit": true,
"canDelete": true,
"title": "Article 2",
"content": "Content 2",
"thumbnail": {
"fileKey": "nlpra/article/activity/A001/thumbnail/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/thumbnail/1"
},
"registrationLink": "https://www.google.com",
"type": 1,
"category": 1,
"subcategory": 0,
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"status": {
"type": 1,
"desc": "草稿"
},
"images": [
{
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
{
"fileKey": "nlpra/article/activity/A001/image/2",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/2"
}
],
"pdf": {
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
"videoLink": "https://www.youtube.com",
"audio": {
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"tags": [
{
"id": "5ba69f4c-1ff8-4c8d-a2df-5abc4470c188",
"name": "test 1"
},
{
"id": "9d202391-f041-4971-9b77-cc3a38c2819f",
"name": "test 2"
}
],
"createAt": "2024-06-24T10:31:49.617768"
}
}

Update article

This endpoint updates an article.

Request (AddArticleReqDTO)

The request body is the same as the request body of the Add Article. The below is an example.

PUT /web/articles/{article_id}
{
"title": "Title",
"content": "Content",
"thumbnail": {
"fileKey": "temp/c5220f9a-8af2-4a75-a092-219768cc4448"
},
"registrationLink": "https://www.google.com",
"category": 1,
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"type": 0
}

Response (ArticleDTO)

{
"success": true,
"message": "",
"data": {
"id": "52e8306d-301b-4985-b9fd-b7b3dd4c43c8",
"canEdit": true,
"canDelete": true,
"title": "Article 2",
"content": "Content 2",
"thumbnail": {
"fileKey": "nlpra/article/activity/A001/thumbnail/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/thumbnail/1"
},
"registrationLink": "https://www.google.com",
"type": 1,
"category": 1,
"subcategory": 0,
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"status": {
"type": 1,
"desc": "草稿"
},
"images": [
{
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
{
"fileKey": "nlpra/article/activity/A001/image/2",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/2"
}
],
"pdf": {
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
"videoLink": "https://www.youtube.com",
"audio": {
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"tags": [
{
"id": "5ba69f4c-1ff8-4c8d-a2df-5abc4470c188",
"name": "test 1"
},
{
"id": "9d202391-f041-4971-9b77-cc3a38c2819f",
"name": "test 2"
}
],
"createAt": "2024-06-24T10:31:49.617768"
}
}

Get article

This endpoint gets an article.

Request

GET /web/articles/{article_id}

Response (ArticleDTO)

{
"success": true,
"message": "",
"data": {
"id": "52e8306d-301b-4985-b9fd-b7b3dd4c43c8",
"canEdit": true,
"canDelete": true,
"title": "Article 2",
"content": "Content 2",
"thumbnail": {
"fileKey": "nlpra/article/activity/A001/thumbnail/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/thumbnail/1"
},
"registrationLink": "https://www.google.com",
"type": 1,
"category": 1,
"subcategory": 0,
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"status": {
"type": 1,
"desc": "草稿"
},
"images": [
{
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
{
"fileKey": "nlpra/article/activity/A001/image/2",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/2"
}
],
"pdf": {
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
"videoLink": "https://www.youtube.com",
"audio": {
"fileKey": "nlpra/article/activity/A001/image/1",
"url": "https://jcci-test-media.aritaone.com/nlpra/article/activity/A001/image/1"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"tags": [
{
"id": "5ba69f4c-1ff8-4c8d-a2df-5abc4470c188",
"name": "test 1"
},
{
"id": "9d202391-f041-4971-9b77-cc3a38c2819f",
"name": "test 2"
}
],
"createAt": "2024-06-24T10:31:49.617768"
}
}

Filter articles

This endpoint filters out mental information.

Request (FilterArticleReqDTO)

POST /web/articles/page
{
"pagination": {
"page": 1,
"size": 10
},
"sortings": [],
"searchKey": "",
"categoryId": 1,
"types": [
1,
2,
3
],
"statusType": 1,
"statuses": [
{
"type": 1,
"desc": "草稿"
}
],
"districts": [
{
"type": 3,
"desc": "葵涌安泰軒"
}
]
}

Response (ArticleSummaryDTO)

{
"success": true,
"message": "",
"data": {
"pagination": {
"page": 1,
"size": 10,
"totalItems": 1,
"totalPages": 1
},
"sortings": [],
"items": [
{
"id": "b618fcfb-404e-408e-90fb-e4d663fde7ba",
"title": "Article 3",
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"type": 0,
"category": 2,
"subcategory": 2,
"status": {
"type": 1,
"desc": "草稿"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"createdAt": "2024-06-25T14:30:04.46335"
}
]
}
}

List article statuses

This endpoint lists all availabile article statuses.

Request (ArticleStatusDTO)

POST /web/articles/statuses/list
{
"type": 1,
"desc": "草稿"
}

Response (ArticleStatusSummaryDTO)

{
"success": true,
"message": "",
"data": [
{
"type": 1,
"desc": "草稿"
},
{
"type": 2,
"desc": "待主任審批"
},
{
"type": 3,
"desc": "待督導審批"
},
{
"type": 4,
"desc": "未上架"
},
{
"type": 5,
"desc": "已上架"
},
{
"type": 6,
"desc": "已下架"
}
]
}

Update article status

This endpoint updates article status.

Request (UpdateArticleStatusDTO)

POST /web/articles/statuses
{
"articleIds": "e0419110-e40c-405b-908a-c757bc5b97e1",
"status": {
"type": 1,
"desc": "草稿"
},
"mark": "remark"
}

Response

{
"success": true,
"message": "",
"data": null
}

Batch update article status

This endpoint updates articles' statuses. It is totaly fine to use this API to update one article's status.

Request (BatchUpdateArticleStatusDTO)

POST /web/articles/statuses/batch
{
"articleIds": [
"e0419110-e40c-405b-908a-c757bc5b97e1",
"0e9279c4-8ad0-47a2-9b3e-a80cf50b73e7"
],
"status": {
"type": 1,
"desc": "草稿"
},
"mark": "remark"
}

Response

{
"success": true,
"message": "",
"data": null
}

Get article logs

This endpoint gets an article's logs.

Request (FilterArticleLogReqDTO)

POST /web/articles/{article_id}/logs
{
"pagination": {
"page": 1,
"size": 10
},
"sortings": []
}

Response (ArticleLogsResDTO)

{
"success": true,
"message": "",
"data": {
"pagination": {
"page": 1,
"size": 10,
"totalItems": 27,
"totalPages": 3
},
"sortings": [],
"items": [
{
"updatedAt": "2024-07-09T02:12:26.379381Z",
"content": "呂渚餁(主任)更改社區資源狀態為【已下架】",
"mark": "落架"
},
{
"updatedAt": "2024-07-05T16:55:20.599576Z",
"content": "呂渚餁(主任)更改社區資源狀態為【已上架】",
"mark": "掂!"
}
]
}
}

Delete article

This endpoint deletes an article.

Request

DELETE /web/articles/{article_id}

Response

{
"success": true,
"message": "",
"data": null
}

Get article order

This endpoint gets article order. The returned list is a sorted list.

Request (GetArticleOrderDTO)

POST /web/articles/order/list
{
"categoryId": 1,
"subcategoryId": 0
}

Response (ArticleOrderSummaryItemDTO)

{
"success": true,
"message": "",
"data": [
{
"id": "b618fcfb-404e-408e-90fb-e4d663fde7ba",
"title": "Article 3",
"centre": "香港心理衞生會",
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"type": 0,
"status": {
"type": 1,
"desc": "草稿"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"createdAt": "2024-06-25T14:30:04.46335",
"ordering": 1
}
]
}

Update article order

This endpoint updates article order.

Request (UpdateArticleOrderDTO)

POST /web/articles/order
{
"categoryId": 1,
"subcategoryId": 0,
"aritcles": [
{
"id": "b618fcfb-404e-408e-90fb-e4d663fde7ba",
"title": "Article 3",
"centre": "香港心理衞生會",
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"type": 0,
"status": {
"type": 1,
"desc": "草稿"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"createdAt": "2024-06-25T14:30:04.46335",
"ordering": 1
}
]
}

Response (ArticleOrderSummaryItemDTO)

{
"success": true,
"message": "",
"data": [
{
"id": "b618fcfb-404e-408e-90fb-e4d663fde7ba",
"title": "Article 3",
"centre": "香港心理衞生會",
"district": {
"type": 3,
"desc": "葵涌安泰軒"
},
"type": 0,
"status": {
"type": 1,
"desc": "草稿"
},
"pushTime": "2024-09-21T00:00:00",
"pullTime": "2024-10-23T00:00:00",
"createdAt": "2024-06-25T14:30:04.46335",
"ordering": 1
}
]
}

Get article status count

This endpoint gets article status count.

Request (ArticleStatusCountReqDTO)

POST /web/articles/count
{
"categoryId": 1
}

Response (ArticleStatusCountResDTO)

{
"success": true,
"message": "",
"data": [
{
"draftCount": 3,
"secondDraftCount": 0,
"thirdDraftCount": 0,
"readyCount": 0,
"publishCount": 0,
"pullCount": 1
}
]
}

Get article log count

This endpoint gets article log count.

Request

GET /web/articles/{article_id}/log-count

Response (ArticleLogCountResDTO)

{
"success": true,
"message": "",
"data": [
{
"logCount": 1
}
]
}


Resources

ArticleDistrictDTO

properties
  • type
    string
    The identifier of the article district.
  • desc
    string
    The name of the article district.

AddArticleTagReqDTO

properties
  • name
    string
    The name of the article tag.

GetArticleTagResDTO

properties
  • id
    string
    The id of the article tag.
  • name
    string
    The name of the article tag.

DeleteArticleTagReqDTO

properties
  • id
    string
    The id of the article tag.
  • name
    string
    The name of the article tag.

AddArticleReqDTO

properties
  • title
    string
    The title of the article.
  • content
    string
    The content of the article.
  • thumbnail
    MediaDTO
    required
    The thumbnail of the article.
  • registrationLink
    string
    The registration link of the article. It is needed only if category = 1.
  • category
    required
    The article category.
  • The district of the article. It is only needed when category is 1. It must be provided when category is 1.
  • subcategory
    default:  0
    The article subcategory. It is only needed when category is 2. It must be privided when category is 2.
  • type
    required
    The type of the article.
  • A list of images. It is only needed when type = 1.
  • The pdf of the article. It is only needed when type = 2.
  • videoLink
    string
    The video link of the article. It is only needed when type = 3.
  • The audio of the article. It is only needed when type = 4.
  • pushTime
    Datetime
    「上架日期」. It has to be in the format YYYY-MM-DDT00:00:00Z. If it is null, the article's push time will be removed.
  • pullTime
    Datetime
    「下架日期」. It has to be in the format YYYY-MM-DDT00:00:00Z. If it is null, the article's pull time will be removed.
  • 「自定义标签」. If it is empty or null, all existing article's tags will be removed.

ArticleDTO

properties
  • id
    string
    The identifier of the article.
  • canEdit
    bool
    It indicates if the article can be edited.
  • canDelete
    bool
    It indicates if the article can be deleted.
  • title
    string
    The title of the article.
  • content
    string
    The content of the article.
  • thumbnail
    MediaDTO
    required
    The thumbnail of the article.
  • registrationLink
    string
    The registration link of the article, This is only needed when category = 1
  • category
    required
    The article category.
  • The district of the article. Its type must be 0 when category is not 1.
  • subcategory
    default:  0
    The article subcategory. It must be 0 when category is not 2.
  • type
    required
    The type of the article.
  • The status of the article.
  • A list of images. It must be an empty array when type is not 1.
  • The pdf of the article. It must be null when type is not 2.
  • videoLink
    string
    The video link of the article. It must be null when type is not 3.
  • The audio of the article. It must be null when type is not 4
  • pushTime
    Datetime
    「上架日期」. It has to be in the format YYYY-MM-DDT00:00:00. If it is null, the article's push time will be removed.
  • pullTime
    Datetime
    「下架日期」. It has to be in the format YYYY-MM-DDT00:00:00. If it is null, the article's pull time will be removed.
  • 「自定义标签」. If it is empty or null, all existing article's tags will be removed.
  • createAt
    Datetime
    The created time.

FilterArticleReqDTO

properties
  • pagination
    Pagination
    required
    index-1
    Indicates the page information of the resource.
  • sortings
    A list of sorting elements, the order of the list matters.
  • searchKey
    string
    The search key should be about title.
  • The category of the article.
  • The type of the article.
  • statusType
    The search key should be about title.
  • A list of article statuses. This is reserved for more advanced use. Frontend may ignore this field.
  • A list of article districts. It is only needed for 「最新消息」

ArticleSummaryDTO

properties
  • pagination
    Pagination
    required
    index-1
    Indicates the page information of the resource.
  • sortings
    A list of sorting elements, the order of the list matters.
  • A list of filtered elements.

ArticleSummaryItemDTO

properties
  • id
    string
    The identifier of the article.
  • title
    string
    The title of the article.
  • district
    ArticleDistrictDTO
    The district of the article. Its type must be 0 when category is not 1.
  • The type of the article.
  • category
    required
    The article category.
  • subcategory
    default:  0
    The article subcategory. It must be 0 when category is not 2.
  • The status of the article.
  • pushTime
    Datetime
    「上架日期」. It has to be in the format YYYY-MM-DDT00:00:00. If it is null, the article's push time will be removed.
  • pullTime
    Datetime
    「下架日期」. It has to be in the format YYYY-MM-DDT00:00:00. If it is null, the article's pull time will be removed.
  • createdAt
    datetime
    創建時間

ArticleStatusSummaryDTO

properties
  • type
    string
    The identifier of the article status.
  • desc
    string
    The name of the article status.

FilterArticleLogReqDTO

properties
  • pagination
    Pagination
    required
    index-1
    Indicates the page information of the resource.
  • sortings
    A list of sorting elements, the order of the list matters.

ArticleLogsResDTO

properties
  • updatedAt
    datetime
    required
    更新時間
  • content
    string
    required
    更新內容
  • mark
    string
    備註

MediaDTO

properties
  • fileKey
    string
    required
    The S3 key for the file or folder.
  • url
    string
    The url path of the uploaded files.

ArticleStatusDTO

properties
  • type
    string
    The identifier of the article status.
  • desc
    string
    The name of the article status.

UpdateArticleStatusDTO

properties
  • articleId
    string
    The identifier of the article.
  • status
    ArticleStatusDTO
    The article status.
  • mark
    string
    備註

BatchUpdateArticleStatusDTO

properties
  • articleIds
    array
    A list of article id.
  • status
    ArticleStatusDTO
    The article status.
  • mark
    string
    備註

GetArticleOrderDTO

properties
  • category
    ArticleCategoryEnum
    required
    The article category.
  • subcategory
    default:  0
    The article subcategory. It must be 0 when category is not 2.

ArticleOrderSummaryItemDTO

properties
  • id
    string
    The identifier of the article.
  • title
    string
    The title of the article.
  • centre
    string
    中心
  • district
    ArticleDistrictDTO
    The district of the article. Its type must be 0 when category is not 1.
  • type
    required
    The type of the article.
  • The status of the article.
  • pushTime
    Datetime
    「上架日期」. It has to be in the format YYYY-MM-DDT00:00:00. If it is null, the article's push time will be removed.
  • pullTime
    Datetime
    「下架日期」. It has to be in the format YYYY-MM-DDT00:00:00. If it is null, the article's pull time will be removed.
  • createdAt
    datetime
    required
    創建時間
  • ordering
    int
    required
    The order position of the articles in the APP.

ArticleStatusCountResDTO

properties
  • draftCount
    int
    required
    草稿數
  • secondDraftCount
    int
    required
    待主任審批數
  • thirdDraftCount
    int
    required
    待督導審批數
  • readyCount
    int
    required
    待上架數
  • publishCount
    int
    required
    已上架數
  • pullCount
    int
    required
    下架數

ArticleStatusCountReqDTO

properties
  • categoryId
    ArticleCategoryEnum
    The category of the article.

ArticleLogCountResDTO

properties
  • logCount
    int
    required
    紀錄數


ArticleCategoryEnum

NameValue
活動推廣1
認識精神健康2
生命故事分享3
專欄分享4

ArticleSubCategoryEnum

NameValue
精神分裂症1
思覺失調2
抑鬱症3
焦慮症4
躁狂抑鬱症5
妄想症6
強迫症7
人格障礙8
其他9

ArticleType

NameValue
純文字0
多圖片1
PDF文件2
影片3
音頻4

StatusType

NameValue
草稿1
待主任審批2
待督導審批3
待上架4
已上架5
已下架6