Open tunahanertekin opened 3 years ago
It is written to add users database with default register method. (email and password)
Body Parameter | Description | Obligation |
---|---|---|
name | User's name in string format. | Yes |
surname | User's surname in string format. | Yes |
password | User's password in string format. | Yes |
User's email address in string format. | Yes | |
phone | User's phone number in string format. | Yes |
In success, user data is returned.
{
"status": "SUCCESS",
"message": "new user is added",
"user": {
"user_id": "20",
"name": "Ali",
"surname": "Yılmaz",
"email": "example@gmail.com",
"phone": "+905065065566"
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
In default login process, users posts their email and password and in return, they get a session key they can use to send their other requests. For development, you can assume that "session_key": "admin"
.
Body Parameter | Description | Obligation |
---|---|---|
User's email address in string format. | Yes | |
password | User's password in string format. | Yes |
{
"status": "SUCCESS",
"message": "login is successful",
"user": {
"user_id": "2",
"name": "Işıl",
"surname": "Güneş",
"email": "igunes@gmail.com",
"phone": "+905435586504"
},
"session": {
"start_time": "Thu Mar 18 2021 22:09:41 GMT+0300 (GMT+03:00)",
"expire_time": "Fri Mar 19 2021 10:09:41 GMT+0300 (GMT+03:00)",
"session_key": "admin"
}
}
{
"status": "SUCCESS",
"message": "login has failed"
}
## Login Using OAuth
It is written to make users be able to login with their Gmail account. If it's their first login with a Google account, they will be registered and given a `session_key`. If not, their credentials will be checked and they will be given a `session_key` if their credentials hold.
### Request
- Type: POST
- URL: /api/users/google-auth
| Body Parameter | Description | Obligation
| ------------- | ------------- | -------------
| access_token | Access token returned by Google/Firebase. | Yes
### Response
- In success, user & session credentials are returned.
```json
{
"status": "SUCCESS",
"message": "user is logged in using a google account",
"user": {
"user_id": 22,
"name": "discuss",
"surname": "bank",
"email": "connectionbauphi@gmail.com",
"phone": "",
"password": "6181738008c985a1b5f106b796c98e719efcc3c0ff68ddcd14a049825f4900a8",
"registration_id": "notset",
"is_oauth_user": true,
"google_sub_id": "108797461518181707543"
},
"session": {
"user_id": 22,
"session_key": "6Oul3E",
"start_time": "2021-04-15T17:18:57.110Z",
"expire_time": "2021-04-16T05:18:57.110Z"
}
}
{
"status": "FAILURE",
"message": "request body fields are not true"
}
It is written to update users' data.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
name | User's name in string format. | No |
surname | User's surname in string format. | No |
password | User's password in string format. | No |
User's email address in string format. | No | |
phone | User's phone number in string format. | No |
{
"status": "SUCCESS",
"message": "user is updated",
"user": {
"user_id": "9",
"name": "Ali",
"surname": "Yılmaz",
"password": "12345678",
"email": "example@gmail.com",
"phone": "+905065065566"
}
}
{
"status": "FAILURE",
"message": "request body fields are not true"
}
It is written to delete users from database.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
{
"status": "SUCCESS",
"message": "user is deleted",
"user": {
"user_id": "9",
"name": "Ali",
"surname": "Yılmaz",
"email": "example@gmail.com",
"phone": "+905055550505"
}
}
{
"status": "FAILURE",
"message": "user is not found"
}
Users' homes can be listed with this endpoint.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, homes of selected user is returned.
{
"status": "SUCCESS",
"message": "all homes of user are listed",
"user_id": "1",
"homes": [
{
"home_id": "1",
"home_owner": "1",
"home_name": "İst 1",
"isVisible": true,
"country": "Turkey",
"state": "İstanbul",
"city": "Sarıyer",
"neighbourhood": "Zekeriyaköy Mah. X Cad. Y Sok. No: 1/2",
"latitude": "41.201170",
"longitude": "29.032128",
"is_pets_allowed": false
},
{
"home_id": "3",
"home_owner": "1",
"home_name": "İst 2",
"isVisible": false,
"country": "Turkey",
"state": "İstanbul",
"city": "Beykoz",
"neighbourhood": "İncirköy Mah. X Cad. Y Sok. No: 1/2",
"latitude": "41.121082",
"longitude": "29.122104",
"is_pets_allowed": false
}
]
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "no home is found"
}
Users can add homes with this endpoint.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
home_name | A name or alias to define home. | Yes |
isVisible | Users' permission if their homes will be listed publicly. | Yes |
country | Country of location. | Yes |
state | State of location. | Yes |
city | City of location. | Yes |
neighbourhood | Neighbourhood and exact address of location. | Yes |
latitude | Latitude coming from client's location. | Yes |
longitude | Longitude coming from client's location. | Yes |
is_pets_allowed | Indicates that if home is convenient for pets. false as default. |
No |
In success, data of home is returned.
{
"status": "SUCCESS",
"message": "new home is added",
"user_id": "1",
"home": {
"home_id": "2",
"home_owner": "1",
"home_name": "İst 1",
"isVisible": false,
"country": "Turkey",
"state": "Sinop",
"city": "Merkez",
"neighbourhood": "X Mah. Y Cad. Z Sok. No: 2/4",
"latitude": "42.2548",
"longitude": "34.5897",
"is_pets_allowed": false
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Users can delete their homes using this endpoint.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, deleted home's data is returned.
{
"status": "SUCCESS",
"message": "home is deleted",
"user_id": "2",
"home": {
"home_id": "2",
"home_owner": "2",
"home_name": "Kast 1",
"isVisible": false,
"country": "Turkey",
"state": "Kastamonu",
"city": "Merkez",
"neighbourhood": "Aktekke Mah. X Cad. Y Sok. No: 1/2",
"latitude": "41.381227",
"longitude": "33.782458",
"is_pets_allowed": false
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "home is not found"
}
Users can update the information of their home from here, also switching cognito/visible mode can be arranged.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
home_name | A name or alias to define home. | No |
isVisible | Users' permission if their homes will be listed publicly. | No |
country | Country of location. | No |
state | State of location. | No |
city | City of location. | No |
neighbourhood | Neighbourhood and exact address of location. | No |
latitude | Latitude coming from client's location. | No |
longitude | Longitude coming from client's location. | No |
is_pets_allowed | Indicates that if home is convenient for pets. false as default. |
No |
In success, changed fields are returned.
{
"status": "SUCCESS",
"message": "home is updated",
"user_id": "1",
"home": {
"home_id": "1",
"city": "Sinop",
"neighbourhood": "X Mah. Y Cad. Z Sok. No: 2/4 Merkez",
"is_pets_allowed": true
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Diagram of request/offer logic is shown below:
Disaster victim can send offers to the home owners about staying at their homes.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
home | ID of home that victim wants to make an offer. | Yes |
home_owner | User ID of the home owner. | Yes |
description | Short info about the situation like how many people, contact info etc. | Yes |
In success, offer sent is returned.
{
"status": "SUCCESS",
"message": "new home request is sent",
"request": [
{
"description": "3 kişiyiz, 1 hafta konaklamak istiyoruz. İletişim: +90504789654",
"results": "Pending",
"victim": 1,
"home_owner": 2,
"home": 2
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Home owner can accept offers received.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
victim | User ID of the victim. | Yes |
home | ID of home that victim wants to make an offer. | Yes |
In success, offer accepted is returned.
{
"status": "SUCCESS",
"message": "request is accepted",
"request": {
"description": "3 kişiyiz, 1 hafta konaklamak istiyoruz. İletişim: +90504789654",
"results": "Accepted",
"victim": 1,
"home_owner": 2,
"home": 2
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Home owner can reject offers received.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
victim | User ID of the victim. | Yes |
home | ID of home that victim wants to make an offer. | Yes |
In success, offer rejected is returned.
{
"status": "SUCCESS",
"message": "request is rejected",
"request": {
"description": "3 kişiyiz, 1 hafta konaklamak istiyoruz. İletişim: +90504789654",
"results": "Rejected",
"victim": 1,
"home_owner": 2,
"home": 2
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Senders can delete their requests. (If it's still pending, that means they cancelled their offer.)
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, offer deleted is returned. Response may contain multiple offers.
{
"status": "SUCCESS",
"message": "home request is deleted",
"request": [
{
"description": "3 kişiyiz, 1 hafta konaklamak istiyoruz. İletişim: +90504789654",
"results": "Rejected",
"victim": 1,
"home_owner": 2,
"home": 2
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "no such request is found"
}
Users can list their offers sent.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, offers sent are returned.
{
"status": "SUCCESS",
"message": "sent home request list is returned",
"requests": [
{
"description": "3 kişiyiz, 1 hafta konaklamak istiyoruz. İletişim: +90504789654",
"results": "Pending",
"victim": 1,
"home_owner": 2,
"home": 2
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "no such request is found"
}
Users can list their offers sent.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, offers sent are returned.
{
"status": "SUCCESS",
"message": "received home request list is returned",
"requests": [
{
"description": "3 kişiyiz, 1 hafta konaklamak istiyoruz. İletişim: +90504789654",
"results": "Pending",
"victim": 1,
"home_owner": 2,
"home": 2
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "no such request is found"
}
It lists users' events.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, users' events are returned.
{
"status": "SUCCESS",
"message": "all events of user are listed",
"user_id": "3",
"events": [
{
"event_id": "3",
"event_starter": "3",
"start_time": "2021-10-30 12:00",
"end_time": "2021-12-30 12:00",
"title": "Elazığ Deprem Mağdurlarına Bağış",
"description": "Elazığ depreminde evini, sağlını kaybeden vatandaşlarımız için sen de 10 TL gönder. Link: www.samplelink.com",
"type": "Donation/Money",
"currency": "TL",
"amount": "10"
},
{
"event_id": "4",
"event_starter": "3",
"start_time": "2021-10-09 00:00",
"end_time": "2021-12-09 00:00",
"title": "Belediye Yemek Alanı",
"description": "Günlük yemek ihtiyacınızı belediyemizin yemek hizmetlerinden karşılayabilirsiniz.",
"type": "Meeting",
"isEmergency": false,
"country": "Turkey",
"state": "Elazığ",
"city": "Merkez",
"neighbourhood": "Elazığ X Cad. Y Sok. No: 2/4",
"latitude": "38.675406",
"longitude": "39.222979"
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "events are not found"
}
It displays an event of a user.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, event is returned.
{
"status": "SUCCESS",
"message": "event is found",
"user_id": "1",
"event": {
"event_id": "2",
"event_starter": "1",
"start_time": "2021-03-20 12:00",
"end_time": "2021-03-20 14:00",
"title": "Sel Afetzedeleri İçin Kermes",
"description": "Siz de afetzedeler için düzenlediğimiz kermese katılabilirsiniz.",
"type": "Donation/Supply",
"country": "Turkey",
"state": "Diyarbakır",
"city": "Bağlar",
"neighbourhood": "Bağcılar Mah. X Cad. Y Sok. No: 2/4",
"latitude": "37.927193",
"longitude": "40.184143"
}
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "event is not found"
}
Events can be added from this endpoint. Additional data about event can be added with "Update Event" request.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
start_time | Event starting date & time. | Yes |
end_time | Event starting date & time. | Yes |
type | Type of event. It can be "Meeting", "Donation/Supply" and "Donation/Money" | Yes |
title | Title of event. | Yes |
description | Further explanation about event. Links can be provided. | Yes |
is_emergency | If event type is "Meeting", it indicates whether the meeting is an emergency. | No |
country | If event type is "Meeting" or "Donation/Supply", it's the country of event. | No |
state | If event type is "Meeting" or "Donation/Supply", it's the state of event. | No |
city | If event type is "Meeting" or "Donation/Supply", it's the city of event. | No |
neighbourhood | If event type is "Meeting" or "Donation/Supply", it's the neighbourhood of event. | No |
latitude | If event type is "Meeting" or "Donation/Supply", it's the latitude of event. | No |
longitude | If event type is "Meeting" or "Donation/Supply", it's the longitude of event. | No |
currency | If event type is "Donation/Money", it indicates the currency used in donation. | No |
amount | If event type is "Donation/Money", it defines the default/minimum donation. | No |
{
"status": "SUCCESS",
"message": "new event is added",
"user_id": "1",
"event": {
"event_id": "25",
"event_starter": "1",
"start_time": "2021-07-09 16:00",
"end_time": "2021-07-09 19:00",
"title": "Deprem Buluşma",
"description": "Deprem bölgesinde olanlar erzak ve sağlık hizmeti için acil toplanma alanına gelsinler!",
"type": "Meeting",
"is_emergency": true,
"state": "Elazığ",
"city": "Merkez",
"neighbourhood": "Elazığ X Cad. Y Sok. No: 2/4",
"latitude": "38.675406",
"longitude": "39.222979"
}
}
- In failure, an error message is returned.
```json
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Events can be removed with this endpoint.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
{
"status": "SUCCESS",
"message": "event is deleted",
"user_id": "1",
"event": {
"event_id": "2",
"event_starter": "1",
"start_time": "2021-03-20::12-00",
"end_time": "2021-03-20::14-00",
"title": "Sel Afetzedeleri İçin Kermes",
"description": "Siz de afetzedeler için düzenlediğimiz kermese katılabilirsiniz.",
"type": "Donation/Supply",
"country": "Turkey",
"state": "Diyarbakır",
"city": "Bağlar",
"neighbourhood": "Bağcılar Mah. X Cad. Y Sok. No: 2/4",
"latitude": "37.927193",
"longitude": "40.184143"
}
}
- In failure, an error message is returned.
```json
{
"status": "FAILURE",
"message": "event is not found"
}
Events can be updated with this endpoint. Additional data can also be added from here.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
start_time | Event starting date & time. | No |
end_time | Event starting date & time. | No |
type | Type of event. It can be "Meeting", "Donation/Supply" and "Donation/Money" | No |
title | Title of event. | No |
description | Further explanation about event. Links can be provided. | No |
is_emergency | If event type is "Meeting", it indicates whether the meeting is an emergency. | No |
country | If event type is "Meeting" or "Donation/Supply", it's the country of event. | No |
state | If event type is "Meeting" or "Donation/Supply", it's the state of event. | No |
city | If event type is "Meeting" or "Donation/Supply", it's the city of event. | No |
neighbourhood | If event type is "Meeting" or "Donation/Supply", it's the neighbourhood of event. | No |
latitude | If event type is "Meeting" or "Donation/Supply", it's the latitude of event. | No |
longitude | If event type is "Meeting" or "Donation/Supply", it's the longitude of event. | No |
currency | If event type is "Donation/Money", it indicates the currency used in donation. | No |
amount | If event type is "Donation/Money", it defines the default/minimum donation. | No |
{
"status": "SUCCESS",
"message": "event is updated",
"user_id": "1",
"event": {
"event_id": "2",
"event_starter": "1",
"end_time": "2021-07-09::19-00",
"description": "Deprem bölgesinde olanlar erzak ve sağlık hizmeti için acil toplanma alanına gelsinler!",
"type": "Meeting",
"state": "Elazığ",
"city": "Merkez",
"neighbourhood": "Elazığ X Cad. Y Sok. No: 2/4",
"latitude": "38.675406",
"longitude": "39.222979"
}
}
- In failure, an error message is returned.
```json
{
"status": "FAILURE",
"message": "event is not found"
}
Users can join events.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
Body Parameter | Description | Obligation |
---|---|---|
event | ID of event. | Yes |
comment | Little comment section about event. | No |
{
"status": "SUCCESS",
"message": "new participation is added",
"participation": {
"attendee": 2,
"event": 1,
"comment": "I am joining.",
}
}
- In failure, an error message is returned.
```json
{
"status": "FAILURE",
"message": "event is not found"
}
Users can cancel event participation.
Header Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
{
"status": "SUCCESS",
"message": "participation is cancelled",
"participation": {
"attendee": 2,
"event": 1,
"comment": "I am joining.",
}
}
- In failure, an error message is returned.
```json
{
"status": "FAILURE",
"message": "event is not found"
}
Users' announcements can be listed with this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, announcements of selected user is returned.
{
"status": "SUCCESS",
"message": "all announcements of user are listed",
"user_id": "3",
"announcements": [
{
"announcement_id": "1",
"ann_starter": "3",
"image": "https://www.macleayargus.com.au/images/transform/v1/crop/frm/ruby.pascoe/36c422d6-5e42-4f85-a4eb-05f9edf9979e.jpg/r0_806_3024_3480_w1200_h678_fmax.jpg",
"phone": "+905067064686",
"title": "Kırmızı Tasmalı Kayıp Evcil Köpek",
"description": "Köpeğim Paris depremin ardından kayboldu. Görenler olursa bu numaradan irtibata geçsinler.",
"isHuman": false
},
{
"announcement_id": "4",
"ann_starter": "3",
"image": "https://www.verywellfamily.com/thmb/DUTf87y7J3Lv0d3cxPiVUcqt_gI=/500x350/filters:no_upscale():max_bytes(150000):strip_icc()/181451278-56a258395f9b58b7d0c931fd.jpg",
"phone": "+905067064686",
"title": "7 yaşındaki oğlum kayıp",
"description": "En son X Devlet Hastanesinde görülmüştür. Görenlerin numaraya veya polise ulaşmaları rica olunur.",
"isHuman": true
}
]
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "announcements are not found"
}
Data of single announcement can be gathered with this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, single announcement of selected user is returned.
{
"status": "SUCCESS",
"message": "announcement is found",
"user_id": "1",
"announcement": {
"announcement_id": "3",
"ann_starter": "1",
"image": "https://i.kym-cdn.com/entries/icons/original/000/016/546/hidethepainharold.jpg",
"phone": "+905417566682",
"title": "Kayıp British Kedi!!!",
"description": "Dün 15.00'dan beri haber alamadım. Bu numaradan arayabilirsiniz.",
"isHuman": false
}
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "announcement is not found"
}
Users can add announcements with this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
image | Link or base64 format text of announcement. | Yes |
phone | Phone for further communication. | Yes |
title | Title of announcement. | Yes |
description | Description of announcement. | Yes |
isHuman | Seperator showing if it's for human or pet. | Yes |
In success, new announcement is returned.
{
"status": "SUCCESS",
"message": "new announcement is added",
"user_id": "1",
"announcement": {
"announcement_id": "85",
"image": "https://www.macleayargus.com.au/images/transform/v1/crop/frm/ruby.pascoe/36c422d6-5e42-4f85-a4eb-05f9edf9979e.jpg/r0_806_3024_3480_w1200_h678_fmax.jpg",
"phone": "+905067064686",
"title": "Kırmızı Tasmalı Kayıp Evcil Köpek",
"description": "Köpeğim Paris depremin ardından kayboldu. Görenler olursa bu numaradan irtibata geçsinler.",
"isHuman": true
}
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Users can delete their announcements with this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
In success, deleted announcement is returned.
{
"status": "SUCCESS",
"message": "announcement is deleted",
"user_id": "1",
"announcement": {
"announcement_id": "3",
"ann_starter": "1",
"image": "https://i.kym-cdn.com/entries/icons/original/000/016/546/hidethepainharold.jpg",
"phone": "+905417566682",
"title": "Kayıp British Kedi!!!",
"description": "Dün 15.00'dan beri haber alamadım. Bu numaradan arayabilirsiniz.",
"isHuman": false
}
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "announcement is not found"
}
Users can update announcements with this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
session_key | Session key for user. (use "admin" ) |
Yes |
image | Link or base64 format text of announcement. | No |
phone | Phone for further communication. | No |
title | Title of announcement. | No |
description | Description of announcement. | No |
isHuman | Seperator showing if it's for human or pet. | No |
In success, updated fields of announcement is returned.
{
"status": "SUCCESS",
"message": "announcement is updated.",
"user_id": "1",
"announcement": {
"announcement_id": "3",
"image": "https://www.macleayargus.com.au/images/transform/v1/crop/frm/ruby.pascoe/36c422d6-5e42-4f85-a4eb-05f9edf9979e.jpg/r0_806_3024_3480_w1200_h678_fmax.jpg",
"phone": "+905067064686"
}
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Users' can display who are attending an event.
In success, id's of participants are listed.
{
"status": "SUCCESS",
"message": "all participants are listed",
"participant_count": 2,
"participants": [
{
"attendee": 4
},
{
"attendee": 2
}
]
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "event is not found"
}
Users can add homes with using AutoLocation feature of BauPhi. Addresses are detected by Nominatim API.
Body Parameter | Description | Obligation |
---|---|---|
latitude | Latitude of user's device. | Yes |
longitude | Longitude of user's device. | Yes |
{
"status": "SUCCESS",
"message": "location api response is returned",
"api_response": {
"api_status": "SUCCESS",
"api_message": "address is returned",
"home_name": "Çamlıdere/Ankara",
"country": "Türkiye",
"state": "Ankara",
"city": "Çamlıdere",
"neighbourhood": "Bayındır"
}
}
Address may not be exact.
{
"status": "SUCCESS",
"message": "location api response is returned",
"api_response": {
"api_status": "FAILURE",
"api_message": "no detailed address, enter manually"
}
}
Address may not be returned by Nominatim API.
{
"status": "SUCCESS",
"message": "location api response is returned",
"api_response": {
"api_status": "FAILURE",
"api_message": "no address data, enter manually"
}
}
In failure, an error message is returned. (error at request format)
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Users can list homes that are close to them with this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
latitude | Latitude coming from client's location. | Yes |
longitude | Longitude coming from client's location. | Yes |
In success, data of near homes is returned. key
field indicates distance(km) between user's location and home's location.
{
"status": "SUCCESS",
"message": "all homes are listed in sorted manner",
"homes": [
{
"key": 1137.2621891392457,
"value": {
"home_id": 9,
"home_owner": 2,
"home_name": "İst 1",
"isVisible": true,
"country": "Turkey",
"state": "Sinop",
"city": "Merkez",
"neighbourhood": "X Mah. Y Cad. Z Sok. No: 2/4",
"latitude": 30.2548,
"longitude": 20.5897
}
},
{
"key": 3660.5240145208745,
"value": {
"home_id": 7,
"home_owner": 1,
"home_name": "İst 1",
"isVisible": true,
"country": "Turkey",
"state": "Sinop",
"city": "Merkez",
"neighbourhood": "X Mah. Y Cad. Z Sok. No: 2/4",
"latitude": 50.2548,
"longitude": 40.5897
}
},
{
"key": 4460.555189434793,
"value": {
"home_id": 8,
"home_owner": 1,
"home_name": "İst 1",
"isVisible": true,
"country": "Turkey",
"state": "Sinop",
"city": "Merkez",
"neighbourhood": "X Mah. Y Cad. Z Sok. No: 2/4",
"latitude": 60.2548,
"longitude": 40.5897
}
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Users can list events that are close to them with this endpoint.
?type=meeting
to the end of the URL. If not, both meeting and supply events will be listed.Query Parameter | Description | Obligation |
---|---|---|
type | Indicates event type. May be meeting or supply . |
No |
Body Parameter | Description | Obligation |
---|---|---|
latitude | Latitude coming from client's location. | Yes |
longitude | Longitude coming from client's location. | Yes |
In success, data of near events is returned. key
field indicates distance(km) between user's location and event's location.
{
"status": "SUCCESS",
"message": "all meeting & supply events are listed in sorted manner",
"events": [
{
"key": 46.74316049122755,
"value": {
"event_id": 2,
"event_starter": 1,
"start_time": "2021-04-01T03:21:02.527Z",
"end_time": "2021-04-01T04:21:02.527Z",
"title": "Event no. 2 Meeting",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Meeting",
"is_emergency": true,
"country": "Türkiye",
"state": "Kütahya",
"city": "Tavşanlı",
"neighbourhood": "Eşen, ",
"latitude": 39.73905,
"longitude": 29.326313
}
},
{
"key": 71.7618888484358,
"value": {
"event_id": 8,
"event_starter": 1,
"start_time": "2021-04-03T02:21:05.517Z",
"end_time": "2021-04-03T03:21:05.517Z",
"title": "Event no. 8 Donation/Supply",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Donation/Supply",
"country": "Türkiye",
"state": "Eskişehir",
"city": "Seyitgazi",
"neighbourhood": "Sandıközü, ",
"latitude": 39.368443,
"longitude": 30.362707
}
},
{
"key": 153.50332676532088,
"value": {
"event_id": 6,
"event_starter": 1,
"start_time": "2021-04-04T03:21:04.516Z",
"end_time": "2021-04-04T06:21:04.516Z",
"title": "Event no. 6 Donation/Supply",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Donation/Supply",
"country": "Türkiye",
"state": "Afyonkarahisar",
"city": "Hocalar",
"neighbourhood": "Avgancık, ",
"latitude": 38.494797,
"longitude": 29.866049
}
},
{
"key": 160.3883329368941,
"value": {
"event_id": 1,
"event_starter": 3,
"start_time": "2021-04-03T02:21:02.028Z",
"end_time": "2021-04-03T04:21:02.028Z",
"title": "Event no. 1 Meeting",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Meeting",
"is_emergency": true,
"country": "Türkiye",
"state": "Denizli",
"city": "Çivril",
"neighbourhood": "Yukarı Çapak, ",
"latitude": 38.432995,
"longitude": 29.877666
}
}
]
}
In failure, an error message is returned.
{
"status": "FAILURE",
"message": "request body fields are not true"
}
Developers can track all info of a user.
In success, all available data of user are returned.
{
"status": "SUCCESS",
"message": "all data related to user is returned",
"user": {
"user_id": 1,
"name": "Tunahan",
"surname": "Ertekin",
"email": "tuna@gmail.com",
"phone": "+905056667788",
"password": "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"
},
"homes": [
{
"home_id": 8,
"home_owner": 1,
"home_name": "Başak Mahallesi/İstanbul",
"isVisible": false,
"country": "Türkiye",
"state": "İstanbul",
"city": "Başakşehir",
"neighbourhood": "Başak Mahallesi, Yaşar Doğu Bulvarı",
"latitude": 41.088978,
"longitude": 28.805779
}
],
"events": [
{
"event_id": 2,
"event_starter": 1,
"start_time": "2021-04-01T03:21:02.527Z",
"end_time": "2021-04-01T04:21:02.527Z",
"title": "Event no. 2 Meeting",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Meeting"
},
{
"event_id": 12,
"event_starter": 1,
"start_time": "2021-04-03T03:21:06.015Z",
"end_time": "2021-04-03T03:21:06.015Z",
"title": "Event no. 12 Donation/Money",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Donation/Money"
},
{
"event_id": 8,
"event_starter": 1,
"start_time": "2021-04-03T02:21:05.517Z",
"end_time": "2021-04-03T03:21:05.517Z",
"title": "Event no. 8 Donation/Supply",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Donation/Supply"
}
],
"announcements": [
{
"announcement_id": 1,
"ann_starter": 1,
"isHuman": true,
"image": null,
"phone": "+908139205912",
"title": "Et impellit synopsis in cognitio pluribus machinam.",
"description": "Cera ad unde co ipsa ideo eo spem prae mo. Memoriae fatendum reversus uno eos habeatur. Remanetne ad eversioni de scriptura considero procedere eo se. Ei id ea ingenio remotis co humanam. "
}
],
"sent_home_requests": [
{
"description": "Yangında evimi kaybettim, yakınlarda otel bulamadım. 1 gün konaklayacak yer arıyorum. Tel: +905056667788",
"results": "Accepted",
"victim": 1,
"home_owner": 3,
"home": 2
}
],
"received_home_requests": [
{
"description": "3 gün kalacak bir yer arıyorum, sonrasında otele yerleştirileceğim. Tek kişiyim. İletişim: +905056667788",
"results": "Pending",
"victim": 4,
"home_owner": 1,
"home": 10
},
{
"description": "Bir hafta konaklamak istiyoruz. 3 kişilik bir aileyiz ve çocuğumuz 4 yaşında. Deprem sonrası evimiz hasar gördü. İletişim: +905056667788",
"results": "Rejected",
"victim": 3,
"home_owner": 1,
"home": 10
}
],
"participations": [
{
"attendee": 1,
"event": 4,
"comment": "Tıbbi malzemeler ile geliyorum."
},
{
"attendee": 1,
"event": 12,
"comment": "$5 bağışlandı."
}
]
}
In failure, an error message is returned..
{
"status": "FAILURE",
"message": "user is not found"
}
Developers can list all homes.
{ "status": "SUCCESS", "message": "all homes in db are returned", "homes": [ { "home_id": 1, "home_owner": 4, "home_name": "Gazi Mahallesi/Ankara", "isVisible": false, "country": "Türkiye", "state": "Ankara", "city": "Yenimahalle", "neighbourhood": "Gazi Mahallesi, Tanaçan Sokak", "latitude": 39.9427, "longitude": 32.809982 }, { "home_id": 2, "home_owner": 3, "home_name": "Naci Çakır Mahallesi/Ankara", "isVisible": true, "country": "Türkiye", "state": "Ankara", "city": "Çankaya", "neighbourhood": "Naci Çakır Mahallesi, 766. Sokak", "latitude": 39.875282, "longitude": 32.844337 }, { "home_id": 10, "home_owner": 1, "home_name": "Ostim Mahallesi/Ankara", "isVisible": true, "country": "Türkiye", "state": "Ankara", "city": "Yenimahalle", "neighbourhood": "Ostim Mahallesi, ", "latitude": 39.982697, "longitude": 32.753178 } ] }
- In failure, an error message is returned..
```json
{
"status": "FAILURE",
"message": "db error"
}
Developers can list all events.
{ "status": "SUCCESS", "message": "all events in db are returned", "events": [ { "event_id": 4, "event_starter": 2, "start_time": "2021-03-30T04:21:03.513Z", "end_time": "2021-03-30T05:21:03.513Z", "title": "Event no. 4 Meeting", "description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ", "type": "Meeting" }, { "event_id": 9, "event_starter": 1, "start_time": "2021-03-31T03:21:06.015Z", "end_time": "2021-03-31T04:21:06.015Z", "title": "Event no. 9 Donation/Money", "description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ", "type": "Donation/Money" }, { "event_id": 5, "event_starter": 5, "start_time": "2021-04-01T03:21:04.006Z", "end_time": "2021-04-01T03:21:04.006Z", "title": "Event no. 5 Donation/Supply", "description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ", "type": "Donation/Supply" }, { "event_id": 6, "event_starter": 1, "start_time": "2021-04-04T03:21:04.516Z", "end_time": "2021-04-04T06:21:04.516Z", "title": "Event no. 6 Donation/Supply", "description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ", "type": "Donation/Supply" } ] }
- In failure, an error message is returned..
```json
{
"status": "FAILURE",
"message": "db error"
}
Developers can list all announcements.
{ "status": "SUCCESS", "message": "all announcements in db are returned", "announcements": [ { "announcement_id": 1, "ann_starter": 1, "isHuman": true, "image": null, "phone": "+908139205912", "title": "Et impellit synopsis in cognitio pluribus machinam.", "description": "Cera ad unde co ipsa ideo eo spem prae mo. Memoriae fatendum reversus uno eos habeatur. Remanetne ad eversioni de scriptura considero procedere eo se. Ei id ea ingenio remotis co humanam. " }, { "announcement_id": 5, "ann_starter": 4, "isHuman": false, "image": null, "phone": "+908139205912", "title": "Et impellit synopsis in cognitio pluribus machinam.", "description": "Cera ad unde co ipsa ideo eo spem prae mo. Memoriae fatendum reversus uno eos habeatur. Remanetne ad eversioni de scriptura considero procedere eo se. Ei id ea ingenio remotis co humanam. " } ] }
- In failure, an error message is returned..
```json
{
"status": "FAILURE",
"message": "db error"
}
Users can see last earthquakes.
Body Parameter | Description | Obligation |
---|---|---|
latitude | Latitude of user's device. | No |
longitude | Longitude of user's device. | No |
{ "status": "SUCCESS", "message": "last ten earthquakes are listed", "earthquakes": [ { "magnitude": 2.2, "location": "MIDILLI ADASI (EGE DENIZI)", "depth": "7.9 km", "date": "2021.04.16 18:00:55", "distance": "1547 km" }, { "magnitude": 1.9, "location": "TAHTALI-GONEN (BALIKESIR)", "depth": "25.3 km", "date": "2021.04.16 17:52:18", "distance": "1684 km" }, { "magnitude": 2.9, "location": "MIDILLI ADASI (EGE DENIZI)", "depth": "2.1 km", "date": "2021.04.16 17:16:21", "distance": "1584 km" }, { "magnitude": 2.1, "location": "YORELI-YAVUZELI (GAZIANTEP)", "depth": "0 km", "date": "2021.04.16 17:12:20", "distance": "1799 km" }, { "magnitude": 2, "location": "SIVRICE (ELAZIG)", "depth": "11.1 km", "date": "2021.04.16 16:50:36", "distance": "1987 km" } ] }
- In failure, an error message is returned..
```json
{
"status": "FAILURE",
"message": "external error"
}
Users can list all funding events.
{
"status": "SUCCESS",
"message": "all money donations in db are returned",
"donations": [
{
"event_id": 9,
"event_starter": 1,
"start_time": "2021-03-31T03:21:06.015Z",
"end_time": "2021-03-31T04:21:06.015Z",
"title": "Event no. 9 Donation/Money",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Donation/Money",
"currency": "₺",
"amount": 5
},
{
"event_id": 12,
"event_starter": 1,
"start_time": "2021-04-03T03:21:06.015Z",
"end_time": "2021-04-03T03:21:06.015Z",
"title": "Event no. 12 Donation/Money",
"description": "Admonitus distincte jam est cogitatio succedens opinantem archetypi. Ita geometriam sub parentibus pensitatis pro. ",
"type": "Donation/Money",
"currency": "$",
"amount": 5
}
]
}
- In failure, an error message is returned..
```json
{
"status": "FAILURE",
"message": "db error"
}
In #19, we defined the data flow for creating a push notification system. Since the notifications are being sent via FCM registration id's, users (mobile agents) must add their unique registration id's using either "Add User" or "Update User" requests. The field to be updated is called registration_id
.
/api/models/Generic.js
sendNotification(notification)
reg_ids
, title
and message
fields. reg_ids
is an array of string that indicates registration id's of users. Others are string fields.You can send test notifications to any mobile agent using this endpoint.
Body Parameter | Description | Obligation |
---|---|---|
reg_ids | An array of string that contains registration id's of users. | Yes |
title | Notification title. | Yes |
message | Notification message. | Yes |
{
"status": "SUCCESS",
"message": "response json is returned by fcm",
"data": {
"multicast_id": 7935663576579045000,
"success": 0,
"failure": 2,
"canonical_ids": 0,
"results": [
{
"error": "InvalidRegistration"
},
{
"error": "InvalidRegistration"
}
]
}
}
{
"status": "FAILURE",
"message": "request's field number is wrong :::"
}
BauPhi API Usage & Backend Documentation
API is accessible in Heroku.
Recent Updates (from newest to oldest):
is_pets_allowed
field is added to the Home. It isfalse
as default.Request
keyword is changed withInteraction
, some endpoints are changed in home offers/requests.isVisible
field is added.Index
Mobile Notifications
Functional Usage
Test Endpoint
Generic Requests
List Event Participants
AutoLocation Using 3rd Party API
List Close Homes
List Close Events
Get User Details (For Development Usage)
Get All Homes (For Development Usage)
Get All Events (For Development Usage)
Get All Announcements (For Development Usage)
Get Last Earthquakes
Get All Money Donations
User Related Requests
Default Register (Add User)
Default Login
Login Using OAuth
Update User
Delete User
Home Related Requests
Get Homes
Add Home
Update Home
Delete Home
Send Offer (Victim-Volunteer Interaction)
Reject Offer (Victim-Volunteer Interaction)
Delete Offer (Victim-Volunteer Interaction)
List Offers Sent (Victim-Volunteer Interaction)
List Offers Received (Victim-Volunteer Interaction)
Event Related Requests
Get Events
Get Event
Add Event
Update Event
Delete Event
Join Event
Cancel Event Participation
Announcement Related Requests
Get Announcements
Get Announcement
Add Announcement
Update Announcement
Delete Announcement