Question
Hawaii Medical Service Association
US
Last activity: 31 May 2016 4:28 EDT
REST Connector: Resource Path Name vs. Query String Parameter
The wizard lists the suggestions for the resource path name and query string parameter for the REST connector. The system assumes the resource path name as static. But we need to check as Is Parameter for those that are not static. What are the criteria to determine the resource path name is static or not?
What are the criteria system is using to determine query string parameter? And what are the other considerations to add or remove them?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
CA
You must first understand the various parts of a URL. Typical URL format is this:
<scheme>://<host>:<port>/<path>?<query_string_params>
where
scheme can be http or https
path is the resource path
query_string_params are typically name=value pairs separated by &
Now, to answer your questions.
The system assumes the resource path name as static. But we need to check as Is Parameter for those that are not static. What are the criteria to determine the resource path name is static or not?
Well, it depends on your requirement. Is the path portion of your URL always static? If yes, do not select Is Parameter for any of the resource path params the wizard prompts. If you have some portion of the path dynamic, as in, whose value varies at runtime, then select Is Parameter for that path parameter. For example, here is a sample URL:
GET http://localhost:8080/api/v1/cases/{id}
In this URL, api/v1/cases/{id} is the resource path of which api/v1/cases is static and {id} is dynamic which you would replace with appropriate case ID at runtime . So, you would select Is Parameter only for id and not for api, v1 and cases.
You must first understand the various parts of a URL. Typical URL format is this:
<scheme>://<host>:<port>/<path>?<query_string_params>
where
scheme can be http or https
path is the resource path
query_string_params are typically name=value pairs separated by &
Now, to answer your questions.
The system assumes the resource path name as static. But we need to check as Is Parameter for those that are not static. What are the criteria to determine the resource path name is static or not?
Well, it depends on your requirement. Is the path portion of your URL always static? If yes, do not select Is Parameter for any of the resource path params the wizard prompts. If you have some portion of the path dynamic, as in, whose value varies at runtime, then select Is Parameter for that path parameter. For example, here is a sample URL:
GET http://localhost:8080/api/v1/cases/{id}
In this URL, api/v1/cases/{id} is the resource path of which api/v1/cases is static and {id} is dynamic which you would replace with appropriate case ID at runtime . So, you would select Is Parameter only for id and not for api, v1 and cases.
What are the criteria system is using to determine query string parameter? And what are the other considerations to add or remove them?
Any part of the URL after ? is considered query string parameters.
-
Mustahseen Shafi Peerzada Adriana Corrales Carvajal
Hawaii Medical Service Association
US
Hi Praneeth,
I have a query string parameter, it takes multiple values in the url. when i run the wizard i get multiple query string parameters. when i complete the wizard, the datapage does not become available because it cannot take duplicate parameters. what is the recommendation?
Pegasystems Inc.
CA
Can you post a sample of your URL?
Hawaii Medical Service Association
US
Hawaii Medical Service Association
US
hi Praneeh,
would you please advise if you need additional information. i provided the sample of url.
Pegasystems Inc.
CA
Hi Gyan,
I've tried a few things but looks like we don't support URLs containing multiple parameters with the same name. At this point, I would recommend that you raise an SR so that we can analyze the effort required to fix this. If this is a blocker, the workaround you have at this point is to modify pyInvokeRESTConnector activity.
Hawaii Medical Service Association
US
Thanks Praneeth
Hi Gyan,
Please let us know here if you end up opening an SR, so that we may track it through this post!
Thanks,
Lochan
-
Aman patel
ConEdison
US
Hi Praneeth,
I also have a similar use case with Bings maps REST API.
URL: http://dev.virtualearth.net/REST/v1/Routes? wayPoint.1=wayPoint1&wayPoint.2=wayPoint2&waypoint.3=wayPoint3&.......wayPoint.n=wayPointn
Here the wayPoint is dynamic, I generated the connector and in query string parameters of the request tab I can add stuff. But how to I form this dynamically at run time and waht to mention in the request tab?
I'm not sure if this is a silly question, never implemented a REST connector so far.
Pega version: 7.1.8
Thanks.
Pegasystems Inc.
CA
Hi Ravi,
By dynamic, do you mean you don't know upfront how many wayPoints you need at runtime and their number varies from one connect call to another? If that's the case, I'm afraid you need to modify pyInvokeRESTConnector activity and set your query string parameters. The configuration on the request tab works best when you have a fixed number of query string parameters.
ConEdison
US
Hi Praneeth,
Thanks for your response. That's correct. for every call it would change. I may have 4 way points for 1 call and 10 way points for another call. The fixed thing here is just the upper limit, I can add maximum of 25 way points. What would you suggest to proceed further? raise SR or do I need to look at pyInvokeRESTConnector code and play around with it ?
Regards,
Ravi Ramineni
Pegasystems Inc.
CA
I suggest you look at the code in pyInvokeRESTConnector activity and modify as per you needs. From a product standpoint, this is an enhancement request.