-
Notifications
You must be signed in to change notification settings - Fork 5
Backend sample test APIs
This wiki will walk you through on how to test all the present APIs in code jammers backend repo.
KeyNote: The APIs are well-validated. It's best to follow the error messages to get an understanding when something is not working as it should.
You can learn more about the project and how to get started here: https://github.com/devcareer/code-jammers-backend/blob/develop/README.md
-
POST
http://localhost:3000/api/v1/users/signup
{
"email": "[email protected]", // you can put your real email.
"password": "123456",
"username": "funmibaby"
}
A verification email will be sent to your email, open the email and click on the verify me
button.
-
POST
http://localhost:3000/api/v1/users/signin
{
"email": "[email protected]",
"password": "123456"
}
-
POST
http://localhost:3000/api/v1/users/recover
{
"email": "[email protected]"
}
Then in the email gotten, click on the reset password
button and copy the link on the page.
Then:
POST http://localhost:3000<the copied link>
{
"newPassword": "123456"
}
-
PATCH
http://localhost:3000/api/v1/user-profile
- Authentication required after sign up/in: Bearer token
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"firstName": "Ufuoma",
"lastName": "Ogodo",
"profilePicture": "https://www.instagram.com/_bellogo/"
}
-
http://localhost:3000/api/v1/auth/google/signup
-
http://localhost:3000/api/v1/auth/google/signin
-
POST
http://localhost:3000/api/v1/newsletter/subscribe
{
"firstName": "Funmilayo",
"email": "[email protected]"
}
-
POST
http://localhost:3000/api/v1/newsletter/admin/create_newsletter
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"title": "What is Lorem Ipsum?",
"message": "Lorem Ipsum is simply dummy text of the printing"
}
-
GET
http://localhost:3000/api/v1/newsletter/unsubscribe/:email
POST http://localhost:3000/api/v1/admin/country
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"nameOfCountry": "Ghana",
"gallery": "https://image.shutterstock.com/image-illustration/togo-flag-silk-260nw-419363206.jpg",
"capital": "Lome",
"population": 205,
"officialLanguage": "English",
"region": "West Africa",
"currency": "CFA franc"
}
-
PATCH
http://localhost:3000/api/v1/admin/country/:countryId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"nameOfCountry": "Togo",
"gallery": "https://image.shutterstock.com/image-illustration/togo-flag-silk-260nw-419363206.jpg",
"capital": "Lome",
"population": 205,
"officialLanguage": "English",
"region": "West Africa",
"currency": "CFA franc"
}
-
DELETE
http://localhost:3000/api/v1/admin/country/:countryId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/country/:countryId
-
GET
http://localhost:3000/api/v1/countries
-
POST
http://localhost:3000/api/v1/admin/state/:countryId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"name": "Kano",
"capital": "Ibadan",
"gallery": "https://en.wikipedia.org/wiki/Lusaka#/mediaJPG"
}
-
PATCH
http://localhost:3000/api/v1/admin/state/:stateId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"name": "Kano",
"capital": "Kano",
"gallery": "https://en.wikipedia.org/wiki/Lusaka#/mediaJPG"
}
-
DELETE
http://localhost:3000/api/v1/admin/state/:stateId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/state/:stateId
-
GET
http://localhost:3000/api/v1/states
-
POST
http://localhost:3000/api/v1/admin/tourist-center/:countryId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"name": "Robben Island Museumm",
"location": "Cape Town",
"gallery": "https://www.fodors.com/assets/destinations/45/robben-island-prison-robben-island-cape-town-south-africa_main.jpg",
"about": "Robben Island is an island in Table Bay, 6.9 kilometres west of the coast of Bloubergstrand, north of Cape Town, South Africa. It takes its name from the Dutch word for seals, hence the Dutch/Afrikaans name Robbeneiland, which translates to Seal Island"
}
-
PATCH
http://localhost:3000/api/v1/admin/tourist-center/:tourist-centerId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"name": "Robben Island Museum",
"location": "Cape Town",
"gallery": "https://www.fodors.com/assets/destinations/45/robben-island-prison-robben-island-cape-town-south-africa_main.jpg",
"about": "Robben Island is an island in Table Bay, 6.9 kilometres west of the coast of Bloubergstrand, north of Cape Town, South Africa. It takes its name from the Dutch word for seals, hence the Dutch/Afrikaans name Robbeneiland, which translates to Seal Island"
}
-
DELETE
http://localhost:3000/api/v1/admin/tourist-center/:tourist-centerId
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/tourist-center/:tourist-centerId
-
GET
http://localhost:3000/api/v1/tourist-centers
-
POST
http://localhost:3000/api/v1/admin/ethnic-group/:ethnic-group-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"name": "Igbo",
"festivals": "New Yamm Festival",
"dressing": "In the old days, some Igbo women celebrated their feast in ekwerike clothing. In other words, they tied thick fabric around their waist. Others preferred painting their bodies with ufle, nzu, edo, uri and other colored ornaments (instead of wearing clothing) and decorating their waist with bead accessories.",
"language": "Igbo",
"gallery": "https://unsplash.com/photos/eS_aZA5S42Y",
"culturalPractices": "The Igbo people have a traditional religious belief that there is one creator, called ‘Chineke’ or ‘Chukwu’. The creator can be approached through many other deities and spirits in the form of natural objects, most commonly through the god of thunder called ‘Amadioha’."
}
-
PATCH
http://localhost:3000/api/v1/admin/ethnic-group/:ethnic-group-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"name": "Igbo",
"festivals": "New Yam Festival",
"dressing": "In the old days, some Igbo women celebrated their feast in ekwerike clothing. In other words, they tied thick fabric around their waist. Others preferred painting their bodies with ufle, nzu, edo, uri and other colored ornaments (instead of wearing clothing) and decorating their waist with bead accessories.",
"language": "Igbo",
"gallery": "https://unsplash.com/photos/eS_aZA5S42Y",
"culturalPractices": "The Igbo people have a traditional religious belief that there is one creator, called ‘Chineke’ or ‘Chukwu’. The creator can be approached through many other deities and spirits in the form of natural objects, most commonly through the god of thunder called ‘Amadioha’."
}
-
DELETE
http://localhost:3000/api/v1/admin/ethnic-group/:ethnic-group-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/ethnic-group/:ethnic-group-id
-
GET
http://localhost:3000/api/v1/ethnic-groups
-
POST
http://localhost:3000/api/v1/admin/food/:food-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"foodName": "Nsh",
"methodOfPreparation": "Nshima is the staple carbohydrate of Zambia. It is made from corn that is processed into a fine white powder called ‘mealie meal’. It is cooked by mixing the corn meal with water which is brought to the boil as porridge (similar to grits). More cornmeal is added until it develops a thicker texture. The cornmeal can be substituted for cassava, sorghum and millet. Nshima is served with a protein (usually meat or fish) and one or two vegetables. Nshima can be enjoyed at any of the many traditional restaurants in Zambia as well as at boutique hotels.",
"gallery":"https://images.unsplash.com/photo-1482049016688-2d3e1b311543?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60"
}
-
PATCH
http://localhost:3000/api/v1/admin/food/:food-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"foodName": "Nsh",
"methodOfPreparation": "Nshima is the staple carbohydrate of Zambia. It is made from corn that is processed into a fine white powder called ‘mealie meal’. It is cooked by mixing the corn meal with water which is brought to the boil as porridge (similar to grits). More cornmeal is added until it develops a thicker texture. The cornmeal can be substituted for cassava, sorghum and millet. Nshima is served with a protein (usually meat or fish) and one or two vegetables. Nshima can be enjoyed at any of the many traditional restaurants in Zambia as well as at boutique hotels. ",
"gallery":"https://images.unsplash.com/photo-1482049016688-2d3e1b311543?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60"
}
-
DELETE
http://localhost:3000/api/v1/admin/food/::food-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/food/:food-Id
-
GET
http://localhost:3000/api/v1/food
-
POST
http://localhost:3000/api/v1/admin/historical-food/:historical-fact-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"location": "Lekki",
"about": "Write anything about Lekki here",
"gallery": "put gallery URL here"
}
-
PATCH
http://localhost:3000/api/v1/admin/historical-food/:historical-fact-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"location": "Lekki",
"about": "Write anything about Lekki here",
"gallery": "put gallery URL here"
}
-
DELETE
http://localhost:3000/api/v1/admin/historical-food/:historical-fact-Id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/historical-fact/:historical-fact-Id
-
GET
http://localhost:3000/api/v1/historical-fact
-
GET
http://localhost:3000/api/v1/historical-fact/location/:locationName
-
POST
http://localhost:3000/api/v1/comment/:related-id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"comment": "I love this place in Lekki, I was there in..."
}
-
GET
http://localhost:3000/api/v1/comment/<comment-id>
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/comments
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
PATCH
http://localhost:3000/api/v1/comment/<comment-id>
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"comment": "I love this place in Lekki, I was there in March this year.",
"relatedId": "<the-related-id>"
}
-
DELETE
http://localhost:3000/api/v1/comment/<comment-id>
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
POST
http://localhost:3000/api/v1/admin/deactivate-user/:<user-id>
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
POST
http://localhost:3000/api/v1/admin/activate-user/:<user-id>
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of an admin, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
POST
http://localhost:3000/api/v1/admin/music/:music-id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"category": "Afrobeat",
"gallery": "https://s3.amazonaws.com/allaboutjazz/photos/a_large/14527396bb98bcb8b452e1a422196975.jpg",
"information": "Afrobeat is a music genre which involves the combination of elements of West African musical styles such as fuji music, Yoruba, and highlife with American funk and jazz influences, with a focus on chanted vocals, complex intersecting rhythms, and percussion. "
}
-
PATCH
http://localhost:3000/api/v1/admin/music/:music-id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
{
"category": "Afrobeat",
"gallery": "https://s3.amazonaws.com/allaboutjazz/photos/a_large/14527396bb98bcb8b452e1a422196975.jpg",
"information": "Afrobeat is a music genre which involves the combination of elements of West African musical styles such as fuji music, Yoruba, and highlife with American funk and jazz influences, with a focus on chanted vocals, complex intersecting rhythms, and percussion. "
}
-
DELETE
http://localhost:3000/api/v1/admin/music/:music-id
- Authentication required after sign up/in: Bearer token
- Make sure the sign in details are that of any user, you can check the seeders file in the database folder
- Add the token gotten from sign up/in to the Bearer field of postman/insomnia
-
GET
http://localhost:3000/api/v1/music/:music-id
-
GET
http://localhost:3000/api/v1/music