Hello everyone,
I want to extract variables on a body JSON and make Statistics with the Statistics Collector policy. I see the tutorial about Extract Variables, I have some ideas but I want to be sure. Can you give me a concrete example ?
Thank you very much.
@Rayan Dinar , It should work as per documentation, It should be simple & straight forward. Just would like to check, have you tried implementing same & stuck with some issue ? BTB, Statistics Collector Policy is currently not working for Trial Orgs due to some feature update. So, You cannot test same in trial orgs right now. Keep us posted if you have any queries. Are you trying to explore same on trial org / paid org ?
I followed this tutorial for the Extract variables JSON part : http://docs.apigee.com/api-services/reference/extract-variables-policy . But after I don't know with the response in the tutorial how can i make Statistics with Statistics Collector. I can't test it now.
@Rayan Dinar , Have you extracted data that you need into flow variables using Extract Variables policy ? You can test same using Trace window in API Proxy editor. Keep us posted. If you have extracted same into flow variables, you just need to reference those flow variables in statistics collector policy.
It's ok like that?
Extract Path Variables
<ExtractVariablesname="Extract-Variables-1">
<Source>response</Source>
<JSONPayload>
<Variablename="latitude"type="float">
<JSONPath>$.results[0].location.lat</JSONPath>
</Variable>
</JSONPayload>
<VariablePrefix>geocoderesponse</VariablePrefix>
</ExtractVariables>
Statistics Collector
<StatisticsCollectorname="Statistics-Collector-1">
<DisplayName>Statistics Collector-1</DisplayName>
<Statistics>
<Statisticname="customLat"ref="geocoderesponse.lat"type="float"/>
</Statistics>
</StatisticsCollector>
Create Flow
<ProxyEndpoint name="default">
<Flows>
<Flow name="default">
<Response>
<Step><Name>Extract-Variables-1</Name></Step>
<Step><Name>Statistics-Collector-1</Name></Step>
</Response>
</Flow>
</Flows>
<!-- The base path -->
<HTTPProxyConnection>
I can't test it
The JSON Response is like that :
{ "name": "France", "countrycode": "FR", "e212": [ 208 ], "dialingcode": "33" }
Could you confirm if you are using :
<Statisticname="customLat"ref="geocoderesponse.lat"type="float"/>
or
<Statisticname="customLat"ref="geocoderesponse.latitude"type="float"/>
because your variable name is defined as :
<Variablename="latitude"type="float">