I am trying to consume the following web-service
@POST
@Path("/delete")
@Produces(MediaType.APPLICATION_JSON)
public boolean deletePost(@QueryParam("idPost") String idPost) {
// logic here
}
However, trying to assign a value to the QueryParam idPost from angular does not work. Always idPost arrives with a value of null.
Try the 2 forms specified in the documentation but it does not work for me. What am I doing wrong?
public deletePost(idPost: number): Observable<any> {
const options = idPost ?
{ params: new HttpParams().set('idPost', idPost.toString()) } : {};
return this.httpClient.post('url-delete',options);
}
public deletePost(idPost: number): Observable<any> {
const params = new HttpParams({fromString: 'idPost=' + idPost.toString()});
return this.httpClient.post('url-delete',params);
}
postis the body. are you sure you want to send the paramters in the body?