Skip to content

Commit e3dd4cb

Browse files
committed
2 parents ebf9756 + 24250bf commit e3dd4cb

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed

README.md

+165
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,167 @@
11
# article-manager
22
Article manager, that add article, update article, find article, and delete article
3+
4+
![sequence diagram for article-manager](https://raw.githubusercontent.com/mariobgsp/article-manager/main/article-manager.png)
5+
6+
## Endpoint API
7+
### GET /articles/all?page={page}&size={size}
8+
Sample Request
9+
```
10+
curl --location 'http://127.0.0.1:8080/articles/all?page=2&size=3' \
11+
--header 'Authorization: {authorization}' \
12+
--header 'Content-Type: application/json' \
13+
```
14+
15+
Sample Response
16+
```
17+
{
18+
"message": "Request Success",
19+
"code": "00",
20+
"status": "Success",
21+
"data": [
22+
{
23+
"id": 4,
24+
"title": "The Impact of Augmented Reality in Healthcare",
25+
"body": "Augmented Reality (AR) applications revolutionize healthcare, offering innovative solutions for medical training and patient care.",
26+
"author": "Diana Miller"
27+
},
28+
{
29+
"id": 5,
30+
"title": "Renewable Energy: Harnessing the Power of the Sun",
31+
"body": "Solar energy gains prominence as a clean and renewable source of power, driving the transition to sustainable energy solutions.",
32+
"author": "Eric Turner"
33+
},
34+
{
35+
"id": 6,
36+
"title": "The Role of Blockchain in Financial Services",
37+
"body": "Blockchain technology transforms the financial services industry, offering secure and decentralized solutions for transactions.",
38+
"author": "Fiona White"
39+
}
40+
]
41+
}
42+
```
43+
44+
### GET /articles/{id}
45+
46+
Sample Request
47+
```
48+
curl --location 'http://127.0.0.1:8080/articles/3' \
49+
--header 'Authorization: {authorization}' \
50+
--header 'Content-Type: application/json' \
51+
```
52+
53+
Sample Response
54+
HTTP 200 OK
55+
```
56+
{
57+
"message": "Request Success",
58+
"code": "00",
59+
"status": "Success",
60+
"data": [
61+
{
62+
"id": 3,
63+
"title": "Digital Transformation in Education",
64+
"body": "Education undergoes a digital transformation, with the integration of technology enhancing learning experiences.",
65+
"author": "Charlie Davis"
66+
}
67+
]
68+
}
69+
```
70+
71+
### POST /articles/add
72+
Sample Request
73+
```
74+
curl --location 'http://127.0.0.1:8080/articles/add' \
75+
--header 'Authorization: {authorization}' \
76+
--header 'Content-Type: application/json' \
77+
--data '{
78+
"title": "Advancements in Quantum Computing",
79+
"body": "Scientists achieve breakthroughs in quantum computing. The new technology promises to revolutionize the field of computation.",
80+
"author": "Alex Rodriguez"
81+
}'
82+
```
83+
Sample Response
84+
HTTP 200 OK
85+
```
86+
{
87+
"message": "Request Success",
88+
"code": "00",
89+
"status": "Success",
90+
"data": {
91+
"id": 23,
92+
"title": "Advancements in Quantum Computing",
93+
"body": "Scientists achieve breakthroughs in quantum computing. The new technology promises to revolutionize the field of computation.",
94+
"author": "Alex Rodriguez"
95+
},
96+
"error": null
97+
}
98+
```
99+
100+
### POST /articles/update/{id}
101+
Sample Request
102+
```
103+
curl --location 'http://127.0.0.1:8080/articles/update/3' \
104+
--header 'Authorization: {authorization}' \
105+
--header 'Content-Type: application/json' \
106+
--data '{
107+
"title": "Advancements in Quantum Computing",
108+
"body": "Scientists achieve breakthroughs in quantum computing. The new technology promises to revolutionize the field of computation.",
109+
"author": "Alex Rodriguez"
110+
}'
111+
```
112+
Sample Response
113+
HTTP 200 OK
114+
```
115+
{
116+
"message": "Article Updated Successfully",
117+
"code": "00",
118+
"status": "Success"
119+
}
120+
```
121+
122+
### POST /articles/delete
123+
Sample Request
124+
```
125+
curl --location --request DELETE 'http://127.0.0.1:8080/articles/delete/3' \
126+
--header 'Authorization: {authorization}' \
127+
--header 'Content-Type: application/json' \
128+
```
129+
Sample Response
130+
HTTP 200 OK
131+
```
132+
{
133+
"message": "Article Deleted Successfully",
134+
"code": "00",
135+
"status": "Success"
136+
}
137+
```
138+
139+
#### Error Response
140+
HTTP 404 NOT FOUND
141+
```
142+
{
143+
"message": "Request Failed",
144+
"code": "01",
145+
"status": "Business Error",
146+
"error": "Article not found"
147+
}
148+
```
149+
HTTP 401 UNAUTHORIZED
150+
```
151+
{
152+
"message": "Request Failed",
153+
"code": "01",
154+
"status": "Business Error",
155+
"error": "Unauthorized"
156+
}
157+
```
158+
HTTP 406 Conflict
159+
```
160+
{
161+
"message": "Request Failed",
162+
"code": "01",
163+
"status": "Business Error",
164+
"error": "Title already exist"
165+
}
166+
```
167+

0 commit comments

Comments
 (0)