Skip to content

Latest commit

 

History

History
152 lines (108 loc) · 2.69 KB

request.rest

File metadata and controls

152 lines (108 loc) · 2.69 KB

// Global Variables @hostname = localhost @port = 3000 @host = {{hostname}}:{{port}}/api/v1 @contentType = application/json @postId = 1 @commentId = 2 @likeId = 1 @fullName = kofta @email = [email protected] @password = dasjad1314 @jwtToken = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjIsImVtYWlsIjoia29mdGFAeGQuY29tIiwiaWF0IjoxNjk2MDk4NDg3LCJleHAiOjE2OTczOTQ0ODd9.RXP7j9CyCfcgbwsNyKbfviary0s2Jz0FTHmPW5zrw0I @jwtToken2ndUser = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjUsImVtYWlsIjoia29mdGFAa29mdGEuY29tIiwiaWF0IjoxNjkzMzIxNzg3LCJleHAiOjE2OTQ2MTc3ODd9.dVKlIaR86E5_kIOXntsB9NmzCnD5Qobu8wW-MVlbMEs @userId = 1

// Posts

// Create a post POST http://{{host}}/posts Content-Type: {{contentType}} Authorization: Bearer {{jwtToken}}

{
"content": "hello"

}

###

// Get all posts GET http://{{host}}/posts?page=3 Authorization: Bearer {{jwtToken}}

###

// Edit a post PUT http://{{host}}/posts?postId={{postId}} Content-Type: {{contentType}} Authorization: Bearer {{jwtToken}}

{
"content": "yo"

}

###

// Delete a post DELETE http://{{host}}/posts?postId={{postId}} Authorization: Bearer {{jwtToken}}

###

// Comments

// Create a comment POST http://{{host}}/comments?postId={{postId}} Content-Type: {{contentType}} Authorization: Bearer {{jwtToken}}

{
"content": "comment"

}

// Get all comments for a post ### GET http://{{host}}/comments?postId={{postId}} Authorization: Bearer {{jwtToken}}

###

// Edit a comment PUT http://{{host}}/comments?commentId={{commentId}} Content-Type: {{contentType}} Authorization: Bearer {{jwtToken2ndUser}}

{
"content": "comment2"

}

###

// Delete a comment DELETE http://{{host}}/comments?commentId={{commentId}} Authorization: Bearer {{jwtToken}}

###

// Posts likes

// Get likes for a post GET http://{{host}}/likes?postId={{postId}}

###

// Like a post POST http://{{host}}/likes?postId={{postId}} Authorization: Bearer {{jwtToken}}

// Unlike a post DELETE http://{{host}}/likes?postId={{postId}} Authorization: Bearer {{jwtToken}}

###

// Comment likes

// Get likes for a comment GET http://{{host}}/likes?commentId={{commentId}}

###

// Like a comment POST http://{{host}}/likes?commentId={{commentId}} Authorization: Bearer {{jwtToken}}

###

// Unlike a comment DELETE http://{{host}}/likes?commentId={{commentId}} Authorization: Bearer {{jwtToken}}

###

// Authentication

// Signup a user POST http://{{host}}/signup Content-Type: {{contentType}}

{
"fullName": "{{fullName}}", "email": "{{email}}", "password": "{{password}}"

}

###

// Login a user POST http://{{host}}/login Content-Type: {{contentType}}

{
"email": "{{email}}", "password": "{{password}}"

}

###

// Profile

// Get profile of user GET http://{{host}}/profile/{{userId}}