Class ArticlesController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.ArticlesController
@RequestMapping("/api/articles")
@RestController
public class ArticlesController
extends ApiController
This is a REST controller for Articles
 This is a REST controller for Articles
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionList all Articles List all ArticlesdeleteArticle(Long id) Delete a ArticlesGet a single date by idpostArticles(String title, String url, String explanation, String email, LocalDateTime dateadded) updateArticle(Long id, @Valid Articles incoming) Update a single articleMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException 
- 
Constructor Details
- 
ArticlesController
public ArticlesController() 
 - 
 - 
Method Details
- 
allArticles
List all Articles List all Articles- Returns:
 - an iterable of Articles
 
 - 
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public Articles getById(@RequestParam Long id) Get a single date by id- Parameters:
 id- the id of the date- Returns:
 - an Article
 
 - 
postArticles
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Articles postArticles(@RequestParam String title, @RequestParam String url, @RequestParam String explanation, @RequestParam String email, @RequestParam("dateadded") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateadded) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
 com.fasterxml.jackson.core.JsonProcessingException
 - 
deleteArticle
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteArticle(@RequestParam Long id) Delete a Articles- Parameters:
 id- the id of the date to delete- Returns:
 - a message indicating the date was deleted
 
 - 
updateArticle
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Articles updateArticle(@RequestParam Long id, @RequestBody @Valid @Valid Articles incoming) Update a single article- Parameters:
 id- id of the date to updateincoming- the new date- Returns:
 - the updated date object
 
 
 -