Boards API

General notes

API detail

Index

curl -X GET "localhost:8080"
GET 8080 HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typetext/html
Content-Length128
DateSat, 20 Jan 2024 22:07:17 GMT
Keep-Alivetimeout=60
Connectionkeep-alive

User

register

curl -X POST -d '{
    "username": "{{username}}",
    "password": "{{password}}"
}' "localhost:8080/api/user/register"
POST 8080/api/user/register HTTP/1.1
Host: 

{
    "username": "{{username}}",
    "password": "{{password}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:25:15 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "Created user with username: newUsername!"
}

current user info

curl -X GET "localhost:8080/api/user/current-user"
GET 8080/api/user/current-user HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:03 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "username": "newUsername",
    "enabled": true,
    "authorities": [
        {
            "authorityName": "ROLE_USER"
        }
    ]
}

change password

curl -X POST -d '{
    "oldPassword":"{{password}}",
    "newPassword":"{{newPassword}}"
}' "localhost:8080/api/user/change-password"
POST 8080/api/user/change-password HTTP/1.1
Host: 

{
    "oldPassword":"{{password}}",
    "newPassword":"{{newPassword}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:15 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "Password for user: newUsername successfully changed!"
}

Posts

new

curl -X POST -d '{
    "title": "{{postTitle}}",
    "content": "{{postContent}}"
}' "localhost:8080/api/posts/new"
POST 8080/api/posts/new HTTP/1.1
Host: 

{
    "title": "{{postTitle}}",
    "content": "{{postContent}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:25 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "New post with id 1 created"
}

update

curl -X POST -d '{
    "title": "{{updatedPostTitle}}",
    "content": "{{updatedPostContent}}"
}' "localhost:8080/api/posts/update/{{postId}}"
POST 8080/api/posts/update/{{postId}} HTTP/1.1
Host: 

{
    "title": "{{updatedPostTitle}}",
    "content": "{{updatedPostContent}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:31 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "Post with id 1 successfully updated"
}

single post

curl -X GET "localhost:8080/api/posts/post/{{postId}}"
GET 8080/api/posts/post/{{postId}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:36 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "id": 1,
    "author": {
        "username": "newUsername",
        "enabled": true
    },
    "content": "updatedContent",
    "removed": false,
    "createdAt": "2024-01-20T19:26:25.000+00:00",
    "updatedAt": "2024-01-20T19:26:31.000+00:00",
    "title": "updatedTitle"
}

all

curl -X GET "localhost:8080/api/posts/all"
GET 8080/api/posts/all HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:42 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
[
    {
        "id": 1,
        "author": {
            "username": "newUsername",
            "enabled": true
        },
        "content": "updatedContent",
        "removed": false,
        "createdAt": "2024-01-20T19:26:25.000+00:00",
        "updatedAt": "2024-01-20T19:26:31.000+00:00",
        "title": "updatedTitle"
    }
]

all paged

curl -X GET "localhost:8080/api/posts/all-paged?page={{page}}&size={{pageSize}}"
GET 8080/api/posts/all-paged?page={{page}}&size={{pageSize}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:26:47 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
[
    {
        "id": 1,
        "author": {
            "username": "newUsername",
            "enabled": true
        },
        "content": "updatedContent",
        "removed": false,
        "createdAt": "2024-01-20T19:26:25.000+00:00",
        "updatedAt": "2024-01-20T19:26:31.000+00:00",
        "title": "updatedTitle"
    }
]

Comments

new

curl -X POST -d '{
    "content": "{{commentContent}}"
}' "localhost:8080/api/comments/new/{{postId}}"
POST 8080/api/comments/new/{{postId}} HTTP/1.1
Host: 

{
    "content": "{{commentContent}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:01 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "New comment with id 1 created"
}

update

curl -X POST -d '{
    "content": "{{updatedCommentContent}}"
}' "localhost:8080/api/comments/update/{{commentId}}"
POST 8080/api/comments/update/{{commentId}} HTTP/1.1
Host: 

{
    "content": "{{updatedCommentContent}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:07 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "Comment with id 1 successfully updated"
}

single comment

curl -X GET "localhost:8080/api/comments/comment/{{commentId}}"
GET 8080/api/comments/comment/{{commentId}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:12 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "id": 1,
    "author": {
        "username": "newUsername",
        "enabled": true
    },
    "content": "updatedComment",
    "removed": false,
    "createdAt": "2024-01-20T19:27:01.000+00:00",
    "updatedAt": "2024-01-20T19:27:07.000+00:00"
}

all for post

curl -X GET "localhost:8080/api/comments/all/{{postId}}"
GET 8080/api/comments/all/{{postId}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:18 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
[
    {
        "id": 1,
        "author": {
            "username": "newUsername",
            "enabled": true
        },
        "content": "updatedComment",
        "removed": false,
        "createdAt": "2024-01-20T19:27:01.000+00:00",
        "updatedAt": "2024-01-20T19:27:07.000+00:00"
    }
]

all for post paged

curl -X GET "localhost:8080/api/comments/all-paged/{{postId}}?page={{page}}&size={{pageSize}}"
GET 8080/api/comments/all-paged/{{postId}}?page={{page}}&size={{pageSize}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:24 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
[
    {
        "id": 1,
        "author": {
            "username": "newUsername",
            "enabled": true
        },
        "content": "updatedComment",
        "removed": false,
        "createdAt": "2024-01-20T19:27:01.000+00:00",
        "updatedAt": "2024-01-20T19:27:07.000+00:00"
    }
]

Admin

disable user

curl -X POST -d '{
    "username": "{{blockUsername}}"
}' "localhost:8080/api/user/disable-user"
POST 8080/api/user/disable-user HTTP/1.1
Host: 

{
    "username": "{{blockUsername}}"
}
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:34 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "User: newUsername was blocked!"
}

remove comment

curl -X POST "localhost:8080/api/comments/remove/{{commentId}}"
POST 8080/api/comments/remove/{{commentId}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:41 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "Comment with id 1 successfully removed"
}

remove post

curl -X POST "localhost:8080/api/posts/remove/{{postId}}"
POST 8080/api/posts/remove/{{postId}} HTTP/1.1
Host: 
Status200 OK
VaryOrigin
VaryAccess-Control-Request-Method
VaryAccess-Control-Request-Headers
X-Content-Type-Optionsnosniff
X-XSS-Protection0
Cache-Controlno-cache, no-store, max-age=0, must-revalidate
Pragmano-cache
Expires0
X-Frame-OptionsDENY
Content-Typeapplication/json
Transfer-Encodingchunked
DateSat, 20 Jan 2024 20:27:48 GMT
Keep-Alivetimeout=60
Connectionkeep-alive
{
    "text": "Post with id 1 successfully removed"
}