在for循环内启动动态HTTP请求 [英] Initiate Dynamic HTTP request inside for loop

查看:231
本文介绍了在for循环内启动动态HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨团队

我正在尝试在Azure APIM中实现以下场景.请提出一种实现相同目的的方法

I am trying to achieve the below scenerio in azure APIM. Please suggest a way to implement the same

场景:

  1. 根据queryparam(keys)** corp中逗号分隔的值来构建动态请求. xyz.com?key=a
    ** corp.xyz.com?key = b
    ** corp.xyz.com?key = c
  2. 获取每个响应并将其混搭为单个响应
  1. Read a value from queryparam : keys=a,b,c
  2. Frame a dynamic request based on the comma separated values in queryparam(keys)**corp.xyz.com?key=a
    **corp.xyz.com?key=b
    **corp.xyz.com?key=c
  3. Get the response of each and mash them as single response

推荐答案

这应该是通过使用这些政策规则可以实现

This should be possible by using these policy rules

  1. 设置变量

您应该能够使用诸如 context.Request.Url.Query.GetValueOrDefault("keys")  或上下文.Request.MatchedParameters.GetValueOrDefault("keys").

引用

Refer this for more information about retrieving query parameters.

  1. 然后使用选择 并 对于您期望的每个键值都有条件
  1. Then control the flow using choose and have conditions for each key value you are expecting

在您之前的状况阻止中, rewrite-uri   policies 相应地

In your condition blocks from before, have rewrite-uri policies accordingly

所有这些都在您的  阻止.


这篇关于在for循环内启动动态HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆