/** POST /articles -> Create a new article. */ @RequestMapping( value = "/articles", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Article> createArticle(@RequestBody Article article) throws URISyntaxException { log.debug("REST request to save Article : {}", article); if (article.getId() != null) { return ResponseEntity.badRequest() .headers( HeaderUtil.createFailureAlert( "article", "idexists", "A new article cannot already have an ID")) .body(null); } article.setI18nTitle(I18n.setTranslationText(article.getI18nTitle(), article.getTitle())); article.setI18nText(I18n.setTranslationText(article.getI18nText(), article.getText())); Article result = articleRepository.save(article); return ResponseEntity.created(new URI("/api/articles/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert("article", result.getId().toString())) .body(result); }