I have a GET endpoint with the URI as the / user / user-id 'User ID' path variable is here.
How can I set path variation while requesting a GET?
This is what I have tried: -
$ http.get ('/ user /: id', {params: {id: key}}); Instead of changing the path variable, the ID is added as the param absolute i.e. my debugger request code to 'http: // localhost: 8080 / user /: id ? Id = test '
My expected solution should be URL' '<$ Http's parameter is for the object query string, so you have passed the key-value passed in the parameter Combination output contains query string key and value.
$ http.get ('/ user', {params: {id: "test"}});
is created: http: // localhost: 8080 / user? Id = test
If you need http: // localhost: 8080 / user / test
, you either:
< Li> You can create the URL yourself,
$ http.get ('/ user /' + id);
-
Or, use $ resource (especially $ resource.get $ resource). It's a bit cleaner.
No comments:
Post a Comment