Question

How to change the REST Service endpoint URL

I am creating a service REST and dont see any option to configure the context url, instead I see it picks automatically "/prweb/PRRestService" from somewhere and adds the service package name, version and service name which are the ones I created.

Eg. https://pega.dev.com/prweb/PRRestService/MYSP/v1/MyService.

1. After creating the service REST can I change this url?

2. Where does it gets the "prweb" and "PRRestService" to build the url?

Comments

Keep up to date on this post and subscribe to comments

December 5, 2019 - 4:56pm

Thanks Susan, that link doesnt really have answer to my question where "prweb" and "PRRestService" are fetched by Pega to construct the url.

Also I tried to save as an existing service rest but I dont see any option to change the url.

Pega
December 5, 2019 - 5:22pm

Service URL is usually in the structure:

http(s)://<host>:<port>/prweb/PRRestService/<servicepackage>/<serviceclass>/<servicemethod>

The Rest service Servlet in Pega is in PRRestService.  

I am not aware of that you can modify it. 

Pega
December 5, 2019 - 7:09pm

Some additional information about creating a REST service. Please check below pdn help link.

https://community.pega.com/sites/default/files/help_v83/procomhelpmain.htm#rule-/rule-service-/rule-service-rest/new.htm

 

December 5, 2019 - 10:32pm

Thanks SusanLiu, this is exactly what I follwed to create the service REST but it doesnt give any details how and where the /prweb can be found and how to use custom url's

December 6, 2019 - 5:14am
Response to KannanM3

http://<hostname>/prweb/PRRestService

First part - "prweb" - it's your web application name. It's definec by your application container (say, tomcat). You can change it there.

Everything, what's after - like here PRRestService - defined in the file web.xml of your prweb application. You can find it in the directory, where it's uploaded.

If you want to completely omit prweb and use URI like http://<hostname>/, then you need to change dispatcher in your webserver (whatever it is - nginx, apache, etc).