weather-rest v0.0.1-6cbf2906.0
Weather REST Services
Available Routes
Unauthenticated routes
GET - Image
Method | Path | Function |
---|---|---|
GET | /images | Get an image for the given parameters |
Required fields:
Field name | Field value |
---|---|
region | District of the user (district Field in Location Collection) |
weatherSituation | weather situation at the moment in the given region (styleClass Field in weatherSituation Collection) |
Response
json { "image": { "_id": "58a2c7a6d486cfef7281ebea", "imageUrl": "<https://img.br.de/b1877270-f2a5-44b7-9d40-d2b55412b892.jpg>", "district": "Oberbayern", "weatherSituation": "wolkig", "__v": 0, "id": "58a2c7a6d486cfef7281ebea" } }
if no result found for the region and weatherSituation Combination, a default image will be returned, even an error occurs.
POST - Upload Image
Method | Path | Function |
---|---|---|
POST (form-data) | /upload | Upload an image for the given parameters |
Required fields:
Field name | Field value |
---|---|
region | District of the user (district Field in Location Collection) |
weatherSituation | weather situation at the moment in the given region (styleClass Field in weatherSituation Collection) |
file | Image as File |
isPublic | true if image should be available publicly |
Response
json { "image": { "_id": "58a2c7a6d486cfef7281ebea", "imageUrl": "<https://img.br.de/b1877270-f2a5-44b7-9d40-d2b55412b892.jpg>", "district": "Oberbayern", "weatherSituation": "wolkig", "__v": 0, "id": "58a2c7a6d486cfef7281ebea" } }
if no result found for the region and weatherSituation Combination, a default image will be returned, even an error occurs.
Autocomplete
Autocomplete service for location search implemented as submodule in weather See https://sepcloud.atlassian.net/wiki/display/WTR/Ortssuche for more information about search logic
Available Routes:
GET /autocomplete/:text
Route for older Applications, text can be either zip or location name
Examples:
localhost:8000/autocomplete/82194
localhost:8000/autocomplete/Mü
GET /location
Parameters: text and maxCount
text can be either zip or location name or combination of both. maxCount: maximum count of results to retrieve
Examples:
localhost:8000/location?text=Mü&maxCount=10
localhost:8000/location?text=80331&maxCount=20
localhost:8000/location?text=80&maxCount=10
localhost:8000/location?text=82194 Grö&maxCount=5
GET /nearLocations
Route for searching location with giveb longitude and latitude, retrieves the nearest location (maximum distance 10kms) to the given geo coordinates
Parameters: lon and lat
Example: localhost:8000/nearLocations?lon=11.27&lat=47.86
//// Reporters
Weather Reporter
implements a REST API for Weather Reporter
Routes to establish CRUD Operations for Reporter and Reporter Observations are provided. The Routes and more details about the routes are listed in following link mapped to the use cases.
https://sepcloud.atlassian.net/wiki/spaces/WTR/pages/80773123/Wettermelder+Usecases
####Create Reporter /reporter/register
Request
// POST, application/json
{ "email": "martintest29@yahoo.com", "height": 417, "institution": null, "internalInfo": "EW: 1500", "lastName" : "Martin3", "firstName": "Marion3", "password": "test3", "phone": "09747 1393", "powerReporter": true, "reachability": "normalerweise ab 5:45 Uhr zu erreichen", "radioReporter": true, "reportForBayern1": true, "reportForBayern3": true, "status": "aktiv", "street": "Keltenstr.19", "userInfo": "Wetterbeobachtung gehört zu meinen Hobby´s." }
Response
{
"reporter": {
"__v": 0,
"height": 417,
"institution": null,
"internalInfo": "EW: 1500",
"lastName": "Vatansever Rubach test test",
"firstName": "Asli test",
"phone": "09747 1393",
"powerReporter": true,
"location": 1,
"reachability": "normalerweise ab 5:45 Uhr zu erreichen",
"radioReporter": true,
"reportForBayern1": true,
"reportForBayern3": true,
"status": "aktiv",
"street": "Keltenstr.19",
"userInfo": "Wetterbeobachtung gehört zu meinen Hobby´s.",
"userId": 28650,
"emailVerified": null,
"createdAt": "2018-03-22T09:58:51.618Z",
"_id": "5ab37e5b0b5dea00c24ece4f",
"graphqlType": "Reporter",
"reporterName": "Asli test Vatansever Rubach test test",
"id": "5ab37e5b0b5dea00c24ece4f"
},
"accessToken": "string", // jwt
"refreshToken": "string"
"expiresIn": number
}
Error states are either MISSING_PARAM, CREATE_FAILED if the parameters like email, password are missing in json or USER_UNAVAILABLE if the user already has an BR-Login Account
{
"success": false,
"code": "USER_UNAVAILABLE",
"message": "USER_UNAVAILABLE"
}
####Edit Reporter Data (except email and password) POST /reporter/edit
Request
POST, application/json HeaderbrLoginAccessToken: ""
{
"email": "martintest29@yahoo.com",
"height": 417,
"institution": null,
"internalInfo": "EW: 1500",
"lastName" : "Martin3",
"firstName": "Marion3",
"phone": "09747 1393",
"powerReporter": true,
"reachability": "normalerweise ab 5:45 Uhr zu erreichen",
"radioReporter": true,
"reportForBayern1": true,
"reportForBayern3": true,
"status": "aktiv",
"userId":123
"street": "Keltenstr.19",
"userInfo": "Wetterbeobachtung gehört zu meinen Hobby´s."
}
####Login a Reporter /reporter/login
Request
// POST, application/json
{
"email" : "vatansev+test28@yahoo.com",
"password":"huhu"
}
Response
{
"reporter": {
"__v": 0,
"height": 417,
"institution": null,
"internalInfo": "EW: 1500",
"lastName": "Vatansever Rubach test test",
"firstName": "Asli test",
"phone": "09747 1393",
"powerReporter": true,
"location": 1,
"reachability": "normalerweise ab 5:45 Uhr zu erreichen",
"radioReporter": true,
"reportForBayern1": true,
"reportForBayern3": true,
"status": "aktiv",
"street": "Keltenstr.19",
"userInfo": "Wetterbeobachtung gehört zu meinen Hobby´s.",
"userId": 28650,
"emailVerified": null,
"createdAt": "2018-03-22T09:58:51.618Z",
"_id": "5ab37e5b0b5dea00c24ece4f",
"graphqlType": "Reporter",
"reporterName": "Asli test Vatansever Rubach test test",
"id": "5ab37e5b0b5dea00c24ece4f"
},
"accessToken": "string", // jwt
}
Error states are either USER_NOT_FOUND, LOGIN_FAILED
{
"success": false,
"code": "USER_UNAVAILABLE",
"message": "USER_UNAVAILABLE"
}
####Get Reporter data with userId /reporter/:userId
Request
// GET, userId as query parameter
Response
{
"reporter": {
"_id": "5a9fe11c290edd004e84e14a",
"firstName": "erste Wettermelder",
"lastName": "TEst test",
"location": 1,
"height": 417,
"street": "Keltenstr.19 Regensburg",
"radioReporter": true,
"reportForBayern1": false,
"reportForBayern3": true,
"reachability": "normalerweise ab 5:45 Uhr zu erreichen",
"callable": true,
"phone": "09747 1393",
"institution": "Mittelfelder Schule",
"userInfo": "Wetterbeobachtung gehört zu meinen Hobby´s.",
"userId": 28642,
"createdAt": "2018-03-07T12:54:52.778Z",
"__v": 0,
"lastLogin": "2018-04-09T12:28:39.356Z",
"emailVerified": true,
"graphqlType": "Reporter",
"reporterName": "erste Wettermelder TEst test",
"id": "5a9fe11c290edd004e84e14a"
}
}
Error states are either USER_NOT_FOUND, MISSING_PARAM
{
"success": false,
"code": "USER_UNAVAILABLE",
"message": "USER_UNAVAILABLE"
}
####Set new Password by old password /reporter/setNewPassword
Request // POST, application/json
{
"email": "Asli.VatanseverRubach@br.de",
"password": "test",
"newPassword": "testnew"
}
Response
{
"success": true
}
Error states are either USER_NOT_FOUND, WRONG_PASSWORD
{
"success": false,
"code": "USER_NOT_FOUND",
"message": "USER_NOT_FOUND"
}
####Request new Password (Request Email) /reporter/sendPassword
Request // POST, application/json
{
"email": "Asli.VatanseverRubach@br.de",
}
Response
{
"success": true
}
Error states are either SERVER_NOT_AVAILABLE, USER_NOT_FOUND
{
"success": false,
"code": "SERVER_NOT_AVAILABLE",
"message": "SERVER_NOT_AVAILABLE"
}
####Verify/Activate Reporter Account GET /?auth=account_created&username=username&token=token
Request // GET
username is Email-Adress und token is jwt, generated by BR-Login Interface Response
{
"success": true
}
Error states are either MISSING_PARAM, USER_NOT_FOUND, ALREADY_CONFIRMED
{
"success": false,
"code": "USER_NOT_FOUND",
"message": "USER_NOT_FOUND"
}
####Set new password by using token (forgot password) /reporter/forcePassword
Request // POST, application/json
{
"token": "string", // received from link in email, set via redirect_uri in request-password-email request
"newPassword": "string",
}
Response
{
"success": true
}
Error states are either SERVER_NOT_AVAILABLE, INVALID_TOKEN, USER_NOT_FOUND
{
"success": false,
"code": "USER_NOT_FOUND",
"message": "USER_NOT_FOUND"
}
####Delete Reporter /reporter/delete
Request
// POST, application/json
HeaderbrLoginAccessToken: ""
{
"userId": number,
"password": string
}
Response
{
"success": true
}
Error states are either SERVER_NOT_AVAILABLE, USER_NOT_FOUND
{
"success": false,
"code": "SERVER_NOT_AVAILABLE",
"message": "SERVER_NOT_AVAILABLE"
}
####Get Reporters (filter and sort) GET /reporters?region=region&radio=radio&callable=callable&status=status
Request // GET
region: Region (optional)
callable: true or false (optional)
status: registered or registrationNotCompleted (optional)
Response
{
"success": true
}
Error states are either MISSING_PARAM, USER_NOT_FOUND, ALREADY_CONFIRMED
{
"success": false,
"code": "USER_NOT_FOUND",
"message": "USER_NOT_FOUND"
}
6 years ago
6 years ago