# API Contract - API CMS (Article Management)
## Get "v1/articles" request only using Bearer Token
__Request__
>Get by Bearer token only. This will return Article Managment list item.
>_`limit` is not required, default `10`_
>_`page` is not required, default `1`_
>_`search` is not required_
>_`sort_by` is not required, default `created_at`_
>_`sort_dir` is not required, default `desc`_
```json
Authorization: Bearer [TOKEN]
Content-Type: application/json
GET v1/articles (list of feature)
```
__Response__ **200**
```json
{
"result" :{
"data": [
{
"id": "string", //optional untuk edit details nantinya
"page_name": "string", //ditampilkan di list item
"created_at": "string", //ditampilkan di list item
"updated_at": "string", //ditampilkan di list item
}
]
"total_data": "number",
"page": "number",
"total_page": "number"
},
"message": "Success"
}
```
## Get "v1/articles/section"
__Request__
>Get by Bearer token and id. This will return Article Managment Detail for website value.
>`page_id` is required, this determine which current website needs to be edited
```json
Authorization: Bearer [TOKEN]
page_name: string
Content-Type: application/json
GET v1/articles/section (details for edit response)
```
__Response__ **200**
```json
{
"result" :{
"website": [
{
"section_name": "string",
"section_script": "string",
"created_at": "string",
"updated_at": "string"
}
]
},
"message": "Success"
}
```
## POST "v1/articles"
__Request__
>This request will add a new page according to page_name in the payload.
```json
Authorization: Bearer [TOKEN]
Content-Type: application/json
POST v1/articles
{
"page_name": "string"
}
```
__Response__ **200**
```json
{
"message": "Success"
}
```
## Patch "v1/articles"
__Request__
>This request will change the value of page name with page id.
```json
Authorization: Bearer [TOKEN]
Content-Type: application/json
Patch v1/articles
{
"page_id": "string",
"page_name": "string"
}
```
__Response__ **200**
```json
{
"message": "Success"
}
```
## Patch "v1/articles/section"
__Request__
>This request will change all sections in db to match section request.
>Note that this request can insert new section, update existing section, and also delete section if necessary
```json
Authorization: Bearer [TOKEN]
Content-Type: application/json
Patch v1/articles/detail
{
"page_id": "string"
"sections": [
{
"section_name": "string",
"section_script": "string"
}
]
}
```
__Response__ **200**
```json
{
"message": "Success"
}
```
## Delete "v1/articles"
__Request__
>This request will delete page with id = page_id and sections inside it
```json
Authorization: Bearer [TOKEN]
Content-Type: application/json
Delete v1/articles
{
"page_id": "string"
}
```
__Response__ **200**
```json
{
"message": "Success"
}
```