📸 Social Media
Create a post
The API allows a logged-in user to create a social media post by providing the necessary details in the request body.
The user can include the content of the post, relevant tags, and attach images (upto 6) as part of the request.
NOTE: As this api requires formData to be used, to send multiple tags client must send them with the respective index.
e.g. if you are passing 4 tags the keys in the, following is onw of the ways to send them:
const formData = new FromData()
// ... other form data appends
tags.forEach((tag, ind) => {
formData.append(`tag[${ind}]`: tag)
})
post/social-media/posts
Response
Create a post
Example response
{
"data": {
"_id": "64a3e3bc9d02a1e3d365f06a",
"author": {
"_id": "64a3daef2aaac053bc597395",
"account": {
"_id": "64a3daee2aaac053bc59725b",
"avatar": {
"_id": "64a3daee2aaac053bc59725c",
"url": "https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/528.jpg"
},
"email": "rebeka.bashirian@yahoo.com",
"username": "delia_zboncak15"
},
"bio": "checkbook lover, photographer",
"countryCode": "+91",
"coverImage": {
"_id": "64a3daef2aaac053bc597394",
"url": "https://via.placeholder.com/800x450.png"
},
"createdAt": "2023-07-04T08:40:15.098Z",
"dob": "2014-10-11T03:26:22.966Z",
"firstName": "Randall",
"lastName": "Ortiz",
"location": "Port Aniyahstad, Aruba",
"owner": "64a3daee2aaac053bc59725b",
"phoneNumber": "9928906598",
"updatedAt": "2023-07-04T08:41:25.069Z"
},
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sapien libero, bibendum sed semper vel, cursus ut enim. Sed a lectus eu ligula varius tincidunt vel vitae odio. Phasellus vel massa odio. Donec in velit eu eros consequat ultrices nec eu nulla. Sed id molestie diam, sed suscipit enim. Ut auctor turpis dui, eu gravida elit molestie nec. Vestibulum posuere eros a dolor iaculis, sollicitudin ullamcorper nisl condimentum.",
"createdAt": "2023-07-04T09:17:48.597Z",
"images": [
{
"_id": "64a3e3bc9d02a1e3d365f06b",
"localPath": "public/images/copper-wire168846226828285707.jpeg",
"url": "http://localhost:8080/images/copper-wire168846226828285707.jpeg"
},
{
"_id": "64a3e3bc9d02a1e3d365f06c",
"localPath": "public/images/bottle168846226828566137.jpg",
"url": "http://localhost:8080/images/bottle168846226828566137.jpg"
},
{
"_id": "64a3e3bc9d02a1e3d365f06d",
"localPath": "public/images/wood168846226851984630.jpeg",
"url": "http://localhost:8080/images/wood168846226851984630.jpeg"
}
],
"tags": [
"new",
"software",
"reactjs"
],
"updatedAt": "2023-07-04T09:17:48.597Z"
},
"message": "Post created successfully",
"statusCode": 201,
"success": true
}