Skip to content

Ethiqque/Pastebin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pastebin

Screenshot 2024-10-01 at 07 27 19

Here are the Postman requests corresponding to the PostController API you've shared:

1. Get Post by ID

GET /posts/{postId}

Request:

GET http://localhost:8080/posts/{postId}

Example:

GET http://localhost:8080/posts/1

Response:

{
  "id": 1,
  "content": "This is the content of the post.",
  "authorId": 101,
  "projectId": 202
}

2. Get All Posts by User

GET /posts/user/{userId}

Request:

GET http://localhost:8080/posts/user/{userId}

Example:

GET http://localhost:8080/posts/user/1

Response:

[
  {
    "id": 1,
    "content": "First post by the user.",
    "authorId": 1,
    "projectId": 101
  },
  {
    "id": 2,
    "content": "Second post by the user.",
    "authorId": 1,
    "projectId": 102
  }
]

3. Create a New Post

POST /posts

Request:

POST http://localhost:8080/posts
Content-Type: application/json

Body (JSON):

{
  "content": "This is a new post",
  "authorId": 1,
  "projectId": 101
}

Response:

{
  "id": 3,
  "content": "This is a new post",
  "authorId": 1,
  "projectId": 101
}

4. Update an Existing Post

PATCH /posts/{postId}

Request:

PATCH http://localhost:8080/posts/{postId}
Content-Type: application/json

Example:

PATCH http://localhost:8080/posts/1

Body (JSON):

{
  "content": "This is the updated content"
}

Response:

{
  "id": 1,
  "content": "This is the updated content",
  "authorId": 1,
  "projectId": 101
}

5. Delete a Post by ID

DELETE /posts/{postId}

Request:

DELETE http://localhost:8080/posts/{postId}

Example:

DELETE http://localhost:8080/posts/1

Response:

HTTP 200 OK (No content)

You can directly use these queries in Postman by replacing localhost:8080 with the actual domain or IP where your service is running, and adjust the paths and bodies as needed for your requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages