jhipster login and how to call a rest api under

 In order to use jhipster user system I needed to find out how to call jhipster, I am planning to do this with curl because it is easiest way to test and see the results.

  curl -v https://xxx.herokuapp.com/api/authenticate -X POST -d '{"password":"xxxxx","username":"admin"}' -H 'Content-Type: application/json' 

 and result is {"id_token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTYzNDY2MDAwM30.1g_8nXgZfTITCfQgewLm8V6PnGKy5kx41dm9gbpJMltVARK8DJZBbbnI-VzQFFO1kkP-8wzVcsB-bvAaHGMPkA"}  

 now I will use this token to call another rest api 
curl "https://xxx.herokuapp.com/api/categories?page=0&size=20&sort=id,asc" -H 'Accept: application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTYzNDY2MDAwM30.1g_8nXgZfTITCfQgewLm8V6PnGKy5kx41dm9gbpJMltVARK8DJZBbbnI-VzQFFO1kkP-8wzVcsB-bvAaHGMPkA'
 

 and result is [{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":null,"advert":null},{"id":1052,"description":"Kiralik Evler","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE"},"advert":null},{"id":1053,"description":"Satilik Evler","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE"},"advert":null}]

Leave a Reply

Your email address will not be published. Required fields are marked *