src/main/java/br/ufpa/labes/spm/web/rest/AgentResource.java
@PostMapping("/agents")
  public ResponseEntity<Agent> createAgent(@Valid @RequestBody Agent agent)
      throws URISyntaxException {
    log.debug("REST request to save Agent : {}", agent);
    if (agent.getId() != null) {
      throw new BadRequestAlertException(
          "A new agent cannot already have an ID", ENTITY_NAME, "idexists");
    }
    Agent result = agentRepository.save(agent);
    return ResponseEntity.created(new URI("/api/agents/" + result.getId()))
        .headers(
            HeaderUtil.createEntityCreationAlert(
                applicationName, true, ENTITY_NAME, result.getId().toString()))
        .body(result);
  }
/**
   * {@code POST /agents} : Create a new agent.
   *
   * @param agent the agent to create.
   * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new
   *     agent, or with status {@code 400 (Bad Request)} if the agent has already an ID.
   * @throws URISyntaxException if the Location URI syntax is incorrect.
   */
POST /agents : Create a new agent.
@param agent the agent to create.
@return the  ResponseEntity with status  201 (Created) and with body the new
agent, or with status  400 (Bad Request) if the agent has already an ID.
@throws URISyntaxException if the Location URI syntax is incorrect.
POST / agents : Create a new agent . @param agent the agent to create . @return the ResponseEntity with status 201 ( Created ) and with body the new agent or with status 400 ( Bad Request ) if the agent has already an ID . @throws URISyntaxException if the Location URI syntax is incorrect .
@PostMapping("/agents")
  public ResponseEntity<Agent> createAgent(@Valid @RequestBody Agent agent)
      throws URISyntaxException {
    log.debug("REST request to save Agent : {}", agent);
    if (agent.getId() != null) {
      throw new BadRequestAlertException(
          "A new agent cannot already have an ID", ENTITY_NAME, "idexists");
    }
    Agent result = agentRepository.save(agent);
    return ResponseEntity.created(new URI("/api/agents/" + result.getId()))
        .headers(
            HeaderUtil.createEntityCreationAlert(
                applicationName, true, ENTITY_NAME, result.getId().toString()))
        .body(result);
  }
@ PostMapping ( "/agents" ) public ResponseEntity < Agent > createAgent ( @ Valid @ RequestBody Agent agent ) throws URISyntaxException { log . debug ( "REST request to save Agent : {}" , agent ) ; if ( agent . getId ( ) != null ) { throw new BadRequestAlertException ( "A new agent cannot already have an ID" , ENTITY_NAME , "idexists" ) ; } Agent result = agentRepository . save ( agent ) ; return ResponseEntity . created ( new URI ( "/api/agents/" + result . getId ( ) ) ) . headers ( HeaderUtil . createEntityCreationAlert ( applicationName , true , ENTITY_NAME , result . getId ( ) . toString ( ) ) ) . body ( result ) ; }
{@code POST /agents} : Create a new agent.
{ @code POST / agents } : Create a new agent .