glance icon indicating copy to clipboard operation
glance copied to clipboard

Allow passing argument to subrequest

Open lostb1t opened this issue 8 months ago • 2 comments

Description

For some of my custom widgets i need to make a secondary requestt based on the result of the main request. But i cannot make subrequest with runtime arguments:

example


        - type: custom-api
          title: Crowdsec
          url: http://100.95.200.149:8090/v1/decisions
          subrequests:
            ipinfo:
               url: getip.com/{{IP}}
          template: |
            <ul class="list list-gap-5 collapsible-container" data-collapse-after="5">
            {{ range .JSON.Array "" | sortByInt "id" "asc" }}
            <li>scenario: {{ .Int "id" }} decision: {{ .String "type" }} ip: {{ .String "value" }}

            {{ $hb := .Subrequest "ipinfo" .Int “value” }}

            country: {{ hb.String "country" }}

</li>
            {{ end }}
            </ul>

lostb1t avatar Apr 06 '25 19:04 lostb1t

Also a bit similar to #555

ralphocdol avatar Apr 09 '25 13:04 ralphocdol

This is now possible in >=v0.8.0.

svilenmarkov avatar May 14 '25 21:05 svilenmarkov