I need to call another internal proxy using service callout and the pass the request of service call out to another proxy

Hi,

While calling another proxy trough service call out i also need to send the request so that i can access in the another proxy's policies but i am getting error:

Service callout:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ServiceCallout async="false" continueOnError="false" enabled="true" name="Service-Callout-1"> <DisplayName>Service Callout-1</DisplayName> <Properties/> <Request clearPayload="true" variable="myRequest"> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> </Request> <Response>calloutResponse</Response> <LocalTargetConnection> <APIProxy>commonproxy</APIProxy> <ProxyEndpoint>default</ProxyEndpoint> </LocalTargetConnection> </ServiceCallout>

And the common proxy is having quota-day policy where i need to extract the parameters:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Quota async="false" continueOnError="false" enabled="true" name="Quota-Day"> <DisplayName>Quota-Day</DisplayName> <FaultRules/> <Properties/> <!-- <Interval>1</Interval> <TimeUnit>minute</TimeUnit> --> <Interval ref="myRequest.quotaIntervalDay"/> <TimeUnit ref="myRequest.quotaTimeunitDay"/> <Allow count="100000" countRef="quota_limit_day"/> <Distributed>true</Distributed> <Synchronous>true</Synchronous> <PreciseAtSecondsLevel>false</PreciseAtSecondsLevel> <Identifier ref="myRequest.tenantId"/> </Quota>

Error:

{"fault":{"faultstring":"Failed to resolve quota interval reference myRequest.quotaIntervalDay in quota policy {1}","detail":{"errorcode":"policies.ratelimit.FailedToResolveQuotaIntervalReference"}}}
0 7 276
7 REPLIES 7

Hi Bhavi, can you explain your complete requirement?

Why do you want to ref variables in Quota policy from another proxy?

It is because there are some parameters that i have set in first proxy now i have to pass it in second proxy through service callout which i am unable to do so

Have you checked the contents of the payload myRequest in the first proxy and the request you received in the commonproxy on the trace? Are you using appropriate content-type header before calling the internal proxy. Shouldn't you be accessing the values in the commonproxy request as request.quotaIntervalDay?

I have seen the commonproxy trace there i am getting my request as (screenshot-611.png) and i have sent as request.quotaIntervalDay (screenshot-610.png) but still i am getting the error the proxy url contains the value of quotaIntervalDay i need to extract taht value please let me know how to do so

proxy.url= http://localhost:8998/?quotaIntervalDay=1&quotaTimeunitDay=day&tenantId=apigatewaytenant_nonprd_01&q...

Looking at the trace for common proxy, you are sending the values in the request query parameters. So in the quota policy you should use request.queryparam.quotaIntervalDay etc

I have done the same but still getting error

Its value is also being not populated

screenshot-612.png