How to access/get REST resource name inside flow service

Hello Community
I want to invoke some flow service in ResponseProcessing policy of API in API Gateway (version 10.11) in order to perform some transformation on response payload.

As part of this transformation logic, I need to capture & use resource name (REST resource name)

For example: suppose my complete request url = /[SomeAPIName]/[SomeVersion]/[SomeResourceName] then in this case I need only the [ResourceName] part of request url inside the flow service (that will be taking care of response tranformation)

However I am unable to get/extract this value inside flow service. I don’t know how I can get this value inside flow service

Below is the screenshot of pub.apigateway.invokeISService.specifications doc.

Can you please let me know which field/document in this screenshot I can use to extract resource name inside the flow service?

Thanks

The service specification shown is the RequestSpec, used in request processing policy. For response processing policies, the specification is pub.apigateway.invokeISService.specifications:ResponseSpec.

Example URL: http://localhost:5555/gateway/petstore/1.0.6/store/inventory

You can extract the resource in a number of ways, depending on your use case.

  1. If processing a request, you can extract from the path variable. (/store/inventory)
  2. If processing a response, you can extract from the requestUrl (http://localhost:5555/gateway/petstore/1.0.6/store/inventory)
  3. In the gateway policies, you can also get the resource path using ${request.path}. (/store/inventory)

Hope this helps,
Theo

@mubarik, if you are using the invokeISService.specification you can get the information from the $path variable and of you not using the invokeISService.specification. You can get this upon reaching the Integration server by using pub.flow:getTransportInfo http/requestUrl

<http>
<requestUrl>/ws/API_Name/Version/resourceName

Thanks @Theodore_Ezell1 for your response. I can see resource name being part of “requestUrl” field value. I appreciate your help

Thanks @DINESH_J for your valuable feedback. I appreciate.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.