-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.php
140 lines (133 loc) · 4.23 KB
/
docs.php
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<div class="container mt-5">
<h1 class="display-4">API Documentation</h1>
<p class="lead">REST API for managing users.</p>
<hr class="my-4">
<h2>API Base URL</h2>
<p><code>https://your-domain.com/api/v1/users/</code></p>
<h2>Endpoints</h2>
<!-- GET All Users -->
<div class="mt-4">
<h3>GET /api/v1/users</h3>
<p>Retrieve a list of all users.</p>
<p><strong>Response Example:</strong></p>
<pre><code>{
"status": "success",
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
},
{
"id": 2,
"name": "Jane Doe",
"email": "jane.doe@example.com"
}
]
}</code></pre>
<p><strong>Status Codes:</strong></p>
<ul>
<li>200 OK - Request was successful.</li>
<li>500 Internal Server Error - Something went wrong on the server.</li>
</ul>
</div>
<!-- GET Single User -->
<div class="mt-4">
<h3>GET /api/v1/users/{id}</h3>
<p>Retrieve a specific user by their ID.</p>
<p><strong>URL Parameters:</strong></p>
<ul>
<li><code>id</code> (required) - The ID of the user to retrieve.</li>
</ul>
<p><strong>Response Example:</strong></p>
<pre><code>{
"status": "success",
"data": {
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}
}</code></pre>
<p><strong>Status Codes:</strong></p>
<ul>
<li>200 OK - Request was successful.</li>
<li>404 Not Found - User not found.</li>
<li>500 Internal Server Error - Something went wrong on the server.</li>
</ul>
</div>
<!-- POST Create User -->
<div class="mt-4">
<h3>POST /api/v1/users</h3>
<p>Create a new user.</p>
<p><strong>Request Body:</strong></p>
<pre><code>{
"name": "New User",
"email": "new.user@example.com"
}</code></pre>
<p><strong>Response Example:</strong></p>
<pre><code>{
"status": "success",
"data": {
"id": 3,
"name": "New User",
"email": "new.user@example.com"
}
}</code></pre>
<p><strong>Status Codes:</strong></p>
<ul>
<li>201 Created - User was successfully created.</li>
<li>400 Bad Request - Invalid data was provided.</li>
<li>500 Internal Server Error - Something went wrong on the server.</li>
</ul>
</div>
<!-- PUT Update User -->
<div class="mt-4">
<h3>PUT /api/v1/users/{id}</h3>
<p>Update an existing user.</p>
<p><strong>URL Parameters:</strong></p>
<ul>
<li><code>id</code> (required) - The ID of the user to update.</li>
</ul>
<p><strong>Request Body:</strong></p>
<pre><code>{
"name": "Updated Name",
"email": "updated.email@example.com"
}</code></pre>
<p><strong>Response Example:</strong></p>
<pre><code>{
"status": "success",
"data": {
"id": 1,
"name": "Updated Name",
"email": "updated.email@example.com"
}
}</code></pre>
<p><strong>Status Codes:</strong></p>
<ul>
<li>200 OK - User was successfully updated.</li>
<li>400 Bad Request - Invalid data was provided.</li>
<li>404 Not Found - User not found.</li>
<li>500 Internal Server Error - Something went wrong on the server.</li>
</ul>
</div>
<!-- DELETE Delete User -->
<div class="mt-4">
<h3>DELETE /api/v1/users/{id}</h3>
<p>Delete a specific user by their ID.</p>
<p><strong>URL Parameters:</strong></p>
<ul>
<li><code>id</code> (required) - The ID of the user to delete.</li>
</ul>
<p><strong>Response Example:</strong></p>
<pre><code>{
"status": "success",
"message": "User deleted successfully."
}</code></pre>
<p><strong>Status Codes:</strong></p>
<ul>
<li>200 OK - User was successfully deleted.</li>
<li>404 Not Found - User not found.</li>
<li>500 Internal Server Error - Something went wrong on the server.</li>
</ul>
</div>
</div>