Class RestApiController
java.lang.Object
com.datengaertnerei.test.dataservice.RestApiController
@RestController
@RequestMapping(value="/api/v1",
produces="application/json")
public class RestApiController
extends Object
Spring Boot main REST API controller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccount()accountForCity(String city) org.springframework.http.ResponseEntity<byte[]> bundles(@jakarta.validation.constraints.Max(50L) int size) landline()landlineForCity(String city) mobile()personForCity(String city, AgeRange age) personForPostcode(String postalCode, AgeRange age)
-
Constructor Details
-
RestApiController
public RestApiController()
-
-
Method Details
-
bundles
@GetMapping("/bundles") public List<Bundle> bundles(@RequestParam(required=false,defaultValue="1") @Max(50L) @jakarta.validation.constraints.Max(50L) int size) - Parameters:
size- the size of the result set- Returns:
- random adult persons inc. phone and payment data
-
mobile
- Returns:
- random german mobile number
-
landline
- Returns:
- random german landline number with generic area code
-
landlineForCity
@GetMapping("/landline/{city}") public PhoneNumber landlineForCity(@PathVariable("city") String city) - Parameters:
city- city name to generate landline number for- Returns:
- random german landline number with area code for the given city (fallback to generic area code if city not found)
-
creditcard
- Returns:
- random credit card (major types, german issuers)
-
account
- Returns:
- random german bank account (uses Frankfurt am Main as default location)
-
accountForCity
- Parameters:
city- city name to generate bank account for- Returns:
- random german bank account for given city (fallback to Frankfurt am Main if no bank found for given city)
-
person
- Parameters:
age- age- Returns:
- random person with a valid german postal address
-
personForCity
@GetMapping("/person/city/{city}") public Person personForCity(@PathVariable("city") String city, @RequestParam(required=false) AgeRange age) - Parameters:
city- cityage- age- Returns:
- random person with a valid german postal address within the given city
-
personForPostcode
@GetMapping("/person/postalcode/{postalcode}") public Person personForPostcode(@PathVariable("postalcode") String postalCode, @RequestParam(required=false) AgeRange age) - Parameters:
postalCode- postalCodeage- age- Returns:
- random person with a valid german postal address within the given postal code (zip) area (1-5 digits)
-
avatar
@GetMapping(value="/avatar", produces="image/png") public org.springframework.http.ResponseEntity<byte[]> avatar(@RequestParam(defaultValue="female",required=false) String gender) - Parameters:
gender- gender- Returns:
- random female or male avatar PNG image
-