Having different Paths in the same Rest API
up vote
1
down vote
favorite
We are using Spring. Is it possible to have different paths in the same REST service. We have one service and we want to have two different endpoints like following in the same REST API. I don't want to follow the best prictices. My question is if it is possible and how? thanks.
http_//domain.com/product/{id}
http_//domain.com/user/{id}
rest spring-boot path endpoint
add a comment |
up vote
1
down vote
favorite
We are using Spring. Is it possible to have different paths in the same REST service. We have one service and we want to have two different endpoints like following in the same REST API. I don't want to follow the best prictices. My question is if it is possible and how? thanks.
http_//domain.com/product/{id}
http_//domain.com/user/{id}
rest spring-boot path endpoint
Of course. Whether it is a good idea or not or how to do it with your particular libraries are potentially more interesting questions than this, however...
– Ken Y-N
Nov 8 at 8:30
Thanks, my intention is not to follow best practices, but if it is possible.
– user217648
Nov 8 at 8:47
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
We are using Spring. Is it possible to have different paths in the same REST service. We have one service and we want to have two different endpoints like following in the same REST API. I don't want to follow the best prictices. My question is if it is possible and how? thanks.
http_//domain.com/product/{id}
http_//domain.com/user/{id}
rest spring-boot path endpoint
We are using Spring. Is it possible to have different paths in the same REST service. We have one service and we want to have two different endpoints like following in the same REST API. I don't want to follow the best prictices. My question is if it is possible and how? thanks.
http_//domain.com/product/{id}
http_//domain.com/user/{id}
rest spring-boot path endpoint
rest spring-boot path endpoint
edited Nov 8 at 8:49
asked Nov 8 at 8:28
user217648
1,01032046
1,01032046
Of course. Whether it is a good idea or not or how to do it with your particular libraries are potentially more interesting questions than this, however...
– Ken Y-N
Nov 8 at 8:30
Thanks, my intention is not to follow best practices, but if it is possible.
– user217648
Nov 8 at 8:47
add a comment |
Of course. Whether it is a good idea or not or how to do it with your particular libraries are potentially more interesting questions than this, however...
– Ken Y-N
Nov 8 at 8:30
Thanks, my intention is not to follow best practices, but if it is possible.
– user217648
Nov 8 at 8:47
Of course. Whether it is a good idea or not or how to do it with your particular libraries are potentially more interesting questions than this, however...
– Ken Y-N
Nov 8 at 8:30
Of course. Whether it is a good idea or not or how to do it with your particular libraries are potentially more interesting questions than this, however...
– Ken Y-N
Nov 8 at 8:30
Thanks, my intention is not to follow best practices, but if it is possible.
– user217648
Nov 8 at 8:47
Thanks, my intention is not to follow best practices, but if it is possible.
– user217648
Nov 8 at 8:47
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
It is possible like below.
@RequestMapping({ "/product/{id}", "/user/{id}" })
Refer multiple-requestmapping-value-with-path-variables
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
It is possible like below.
@RequestMapping({ "/product/{id}", "/user/{id}" })
Refer multiple-requestmapping-value-with-path-variables
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
add a comment |
up vote
1
down vote
It is possible like below.
@RequestMapping({ "/product/{id}", "/user/{id}" })
Refer multiple-requestmapping-value-with-path-variables
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
add a comment |
up vote
1
down vote
up vote
1
down vote
It is possible like below.
@RequestMapping({ "/product/{id}", "/user/{id}" })
Refer multiple-requestmapping-value-with-path-variables
It is possible like below.
@RequestMapping({ "/product/{id}", "/user/{id}" })
Refer multiple-requestmapping-value-with-path-variables
answered Nov 8 at 9:11
Alien
3,53821022
3,53821022
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
add a comment |
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
But if you have different Services on the same server, does it needs to know which server the endpoints belong to? The service it self adds some root path before /product or /user. I need to remove it to.
– user217648
Nov 8 at 11:57
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
that you can not control like this if you have any base mapping url for controller also for different server.
– Alien
Nov 8 at 12:27
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203900%2fhaving-different-paths-in-the-same-rest-api%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Of course. Whether it is a good idea or not or how to do it with your particular libraries are potentially more interesting questions than this, however...
– Ken Y-N
Nov 8 at 8:30
Thanks, my intention is not to follow best practices, but if it is possible.
– user217648
Nov 8 at 8:47