Skip to content

l3alisidahmed/Social-Media-FaceInsta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Live URL

Api Design 🌐

Posts Api Design 📜

Create Post
Endpoint (URL): /api/v1/posts
HTTP Request Method: POST
Request Body:

  {
    "description": <DESC>,
    "image": <IMG>
  }

Success Response Body:

  {
    "success": "true",
    {
      "id": <ID>,
      "description": <DESC>,
      "image": <IMG>,
      "createdAt": <DATE>
    }
  }

Fail Response Body:

  {
    "success": "false",
    "message": "Description And Image Fields Are Null! Fill One Field At Least"
  }

Get All Posts
Endpoint (URL): /api/v1/posts
HTTP Request Method: GET
Success Response Body:

  {
    "success": "true",
    "posts": [
      {
        "id": <ID1>,
        "description": <DESC>,
        "image": <IMG>,
        "createdAt": <DATE>
      },
      {
        "id": <ID2>,
        "description": <DESC>,
        "image": <IMG>,
        "createdAt": <DATE>
      }
    ]
  }

Get Post
Endpoint (URL): /api/v1/posts/:id
HTTP Request Method: GET
Success Response Body:

  {
    "success": "true",
    {
      "id": <ID>,
      "description": <DESC>,
      "image": <IMG>,
      "createdAt": <DATE>
    }
  }

Fail Response Body:

  {
    "success": "false",
    "message": "Fill One Field At Least"
  }

Update Post
Endpoint (URL): /api/v1/posts/:id
HTTP Request Method: PUT
Request Body:

  {
    "description": <DESC>,
    "image": <IMG>
  }

Success Response Body:

  {
    "success": "true",
    {
      "id": <ID>,
      "description": <DESC>,
      "image": <IMG>,
      "createdAt": <DATE>
    }
  }

Fail Response Body:

  {
    "success": "false",
    "message": "Description And Image Fields Are Null! Fill One Field At Least"
  }

Delete Post
Endpoint (URL): /api/v1/posts/:id
HTTP Request Method: DELETE
Success Response Body:

  {
    "success": "true",
    "message": "Post With ID <ID> Has Been Deleted"
  }

Fail Response Body:

  {
    "success": "false",
    "message": "There is no Comment With The ID <ID> !"
  }

Comments Api Design 💬

Add Comment
Endpoint (URL): /api/v1/posts/:id/comments/:id
HTTP Request Method: POST
Request Body:

  {
    "content": <COMMENT_CONTENT>
  }

Success Response Body:

  {
    "success": "true",
    {
      "id": <ID>,
      "content": <COMMENT_CONTENT>,
      "createdAt": <DATE>
    }
  }

Fail Response Body:

  {
    "success": "false",
    "message": "Content Field Can't be Null! Fill Content Field Please"
  }

Get All Comments
Endpoint (URL): /api/v1/posts/:id/comments
HTTP Request Method: GET
Success Response Body:

  {
    "success": "true",
    "comments": [
      {
        "id": <ID1>,
        "content": <COMMENT_CONTENT>,
        "createdAt": <DATE>
      },
      {
        "id": <ID2>,
        "content": <COMMENT_CONTENT>,
        "createdAt": <DATE>
      }
    ]
  }

Update Comment
Endpoint (URL): /api/v1/posts/:id/comments/:id
HTTP Request Method: PUT
Request Body:

  {
    "content": <COMMENT_CONTENT>
  }

Success Response Body:

  {
    "success": "true",
    {
      "id": <ID>,
      "content": <COMMENT_CONTENT>,
      "createdAt": <DATE>
    }
  }

Fail Response Body:

  {
    "success": "false",
    "message": "Fill One Field At Least"
  }

Delete Comment
Endpoint (URL): /api/v1/posts/:id/comments/:id
HTTP Request Method: DELETE
Success Response Body:

  {
    "success": "true",
    "message": "Comment With ID <ID> Has Been Deleted"
  }

Fail Response Body:

  {
    "success": "false",
    "message": "There is no Comment With The ID <ID> !"
  }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •