Skip to content

Api calls from web

Nguyễn Gia Hy edited this page Mar 17, 2022 · 6 revisions

Table of Contents

  1. Login
  2. Signup
  3. Get Videos
  4. Get user videos
  5. Create video
  6. Update video
  7. Delete video

📋 Call from website to BFF

Login

null
  • BODY:
{
    "email":"email",
    "password":"password"
}
  • SAMPLE RESPONSE BODY:
{
    "message": "logged in",
    "user": {
        "_id": "62299989ca8da97c670fbcf3",
        "username": "Tony",
        "email": "hyhy123@gmail.com",
        "password": "test12345",
        "userImage": "https://media.istockphoto.com/vectors/user-icon-flat-style-isolated-on-white-background-vector-id1084418050?k=20&m=1084418050&s=612x612&w=0&h=pm3Ov7GL8rnKKqe98FEfoya6A6UK-z4Iv60LPbj38GE=",
        "videos": [
            "622aa84907a8529fe0e431c6"
        ],
        "__v": 7,
        "id": "62299989ca8da97c670fbcf3"
    }
}

Signup

null
  • BODY:
{
    "username": "username",
    "email": "email",
    "password": "password"
}
  • SAMPLE RESPONSE BODY:
{
    "user": {
        "username": "Tony",
        "email": "hyhy1234@gmail.com",
        "password": "test12345",
        "userImage": "https://media.istockphoto.com/vectors/user-icon-flat-style-isolated-on-white-background-vector-id1084418050?k=20&m=1084418050&s=612x612&w=0&h=pm3Ov7GL8rnKKqe98FEfoya6A6UK-z4Iv60LPbj38GE=",
        "videos": [],
        "_id": "6232208aeaed6760cbe5d033",
        "__v": 0,
        "id": "6232208aeaed6760cbe5d033"
    }
}

Get video

null
  • BODY:
null
  • SAMPLE RESPONSE BODY:
{
    "videos": [
        {
            "resource": {
                "imageUrl": "uploads\\images\\7d76a058-643e-41b2-ae2a-1e00782a7403.jpeg",
                "videoUrl": "https://www.youtube.com/watch?v=Pv7JKxRd7jo"
            },
            "_id": "6231f2371c2c8935c218195d",
            "title": "HOw to make youtuvideo",
            "description": "this is video about youtube creation",
            "createdDate": 1647440324034,
            "creator": {
                "_id": "6231ea9f08f94f430f383b28",
                "username": "tonysodeep",
                "id": "6231ea9f08f94f430f383b28"
            },
            "__v": 0,
            "id": "6231f2371c2c8935c218195d"
        },
        {
            "resource": {
                "imageUrl": "uploads\\images\\bc4880db-7e3c-4bf7-80ee-14659d0ce4c9.jpeg",
                "videoUrl": "https://www.youtube.com/watch?v=Pv7JKxRd7jo"
            },
            "_id": "6232034f7a202a0a63079606",
            "title": "how to creat other youtube image",
            "description": "hello this is another iamges",
            "createdDate": 1647444807886,
            "creator": {
                "_id": "6231ea9f08f94f430f383b28",
                "username": "tonysodeep",
                "id": "6231ea9f08f94f430f383b28"
            },
            "__v": 0,
            "id": "6232034f7a202a0a63079606"
        }
    ]
}

Get user videos

null
  • BODY:
null
  • SAMPLE RESPONSE BODY:
{
    "name": "tonysodeep",
    "imageUrl": "uploads\\images\\40e92cb9-f98a-4862-a887-b281d00abc82.jpeg",
    "userVideos": [
        {
            "resource": {
                "imageUrl": "uploads\\images\\7d76a058-643e-41b2-ae2a-1e00782a7403.jpeg",
                "videoUrl": "https://www.youtube.com/watch?v=Pv7JKxRd7jo"
            },
            "_id": "6231f2371c2c8935c218195d",
            "title": "HOw to make youtuvideo",
            "description": "this is video about youtube creation",
            "createdDate": 1647440324034,
            "creator": "6231ea9f08f94f430f383b28",
            "__v": 0,
            "id": "6231f2371c2c8935c218195d"
        },
        {
            "resource": {
                "imageUrl": "uploads\\images\\bc4880db-7e3c-4bf7-80ee-14659d0ce4c9.jpeg",
                "videoUrl": "https://www.youtube.com/watch?v=Pv7JKxRd7jo"
            },
            "_id": "6232034f7a202a0a63079606",
            "title": "how to creat other youtube image",
            "description": "hello this is another iamges",
            "createdDate": 1647444807886,
            "creator": "6231ea9f08f94f430f383b28",
            "__v": 0,
            "id": "6232034f7a202a0a63079606"
        }
    ]
}

Create video

null
  • BODY:
{
    "title": "title",
    "description": "description",
    "creator": "creator"
}
  • SAMPLE RESPONSE BODY:
{
    "video": {
        "title": "Sport video of readme",
        "description": "n publishing and graphic design, Lorem ipsum is a placeholder text commonly used",
        "createdDate": 1647423349493,
        "resource": {
            "imageUrl": "https://richardhill.cz/wp-content/uploads/2017/02/Video-Icon-crop.png",
            "videoUrl": "https://www.youtube.com/watch?v=Pv7JKxRd7jo"
        },
        "creator": "62299989ca8da97c670fbcf3",
        "_id": "6231b1abeaed6760cbe5d027",
        "__v": 0,
        "id": "6231b1abeaed6760cbe5d027"
    }
}

Update video

null
  • BODY:
{
    "title": "title",
    "description":"description"
}
  • SAMPLE RESPONSE BODY:
{
    "updatedVideo": {
        "resource": {
            "imageUrl": "uploads\\images\\7d76a058-643e-41b2-ae2a-1e00782a7403.jpeg",
            "videoUrl": "https://www.youtube.com/watch?v=Pv7JKxRd7jo"
        },
        "_id": "6231f2371c2c8935c218195d",
        "title": "Cat playing pinano supper cute",
        "description": "this is update description",
        "createdDate": 1647440324034,
        "creator": "6231ea9f08f94f430f383b28",
        "__v": 0,
        "id": "6231f2371c2c8935c218195d"
    }
}

Delete video

null
  • BODY:
null
  • SAMPLE RESPONSE BODY:
{
    "message": "Deleted Video"
}

Clone this wiki locally