From bd5cacd14aee84854b0339dc24e3161211e463d5 Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Tue, 13 May 2025 18:55:57 +0100 Subject: [PATCH] Update docs --- docs/custom-api.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/custom-api.md b/docs/custom-api.md index cd88efa..566aa58 100644 --- a/docs/custom-api.md +++ b/docs/custom-api.md @@ -366,15 +366,16 @@ In some instances, you may need to make two consecutive API calls, where you use - type: custom-api url: https://api.example.com/get-id-of-something template: | + {{ $theID := .JSON.String "id" }} + {{ - $theID := .JSON.String "id" $something := newRequest (concat "https://api.example.com/something/" $theID) | withParameter "key" "value" | withHeader "Authorization" "Bearer token" | getResponse }} - {{ $something.String "title" }} + {{ $something.JSON.String "title" }} ``` Here, `$theID` gets retrieved from the result of the first API call and used in the second API call. The `newRequest` function creates a new request, and the `getResponse` function executes it. You can also use `withParameter` and `withHeader` to optionally add parameters and headers to the request.