API method searches for information but does not appear in front-end

Asked

Viewed 116 times

2

I have a method of my API that does a database search

@RequestMapping(method = RequestMethod.GET, value = "/entidadesUsuarioPermissao/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Collection<PermissoesPaginas>> buscarEntidadesUsuarioP(@PathVariable Long id) {

        Collection<PermissoesPaginas> entidadesBuscados = ppService.buscarTodas(id);
        return new ResponseEntity<>(entidadesBuscados, HttpStatus.OK);

    } 

and all the information I need comes from: inserir a descrição da imagem aqui

however, when I debug in front-end the entity object does not appear

That’s my answer to the front end inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

note that the entity object does not appear.

the front-end method is this:

$http({
                method : 'GET',
                url : '/entidadesUsuarioPermissao/'+id

            }).then(function(response) {
                $scope.usuarios = response.data;


            }, function(response) {
                console.log(response.data);
                console.log(response.status);
            });

console output on screen

inserir a descrição da imagem aqui

  • Not within users > permissionsPaginasCollection ?

2 answers

0

Add "@Responsebody" to your annotation and use this jackjson

@RequestMapping (value="/services/SayHello2Me" , method=RequestMethod.GET, produces="application/json")
  • nothing has changed, keeps coming the same..

0

As verified, the problem was in the get method within the Permissions class, where the entity name was not mapped for display.

  • Rhadamez, none of the alternatives helped, continued the same result.

  • Okay, so swap the type of "Collection" for "List", and try the second option of my answer.

  • Print this list on the console to see if when the method is called, it’s actually printing, something else, you use Postman to test the API?

  • Actually I have tested the screen because it is already ready.. the console is in question..

  • But in your IDE’s console, it even displays list values?

  • yes.. all information appears..

  • In this case, the problem must be in the call of this endpoint, you can make available the code you are calling to show in html?

  • 1
Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.