-
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.
-
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/"
}
-
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
{
"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
{
"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
GET http://localhost:3000/api/v1/tourist-center/:tourist-centerId
GET http://localhost:3000/api/v1/tourist-centers