Using context request data variable in body transformation

I’ve created new Get endpoint, which receive “param1” as query parameter. Thus, I would like to transform to Post target calling and using “param1” value as part of new json body data. However, I cannot access ._tyk_context.request_data variables under transform template. Can you suggest me how to retrieve value of “param1” query parameter?

Have you enabled context variables in the API Definition? They are not enabled by default - you can find the option under Advanced Options in the dashboard API Designer for your API.

Ahhh, thank Martin, request template transform was working now.

By the way, the response template seem to be not apply on the response of service. I’ve used Tyk dashboard to create endpoint API, I’ve tested on Body transform plugin by providing JSON input, Golang template, which I got the result as my expected when I click “Test”.

However, when I call the endpoint on web browser, the service return the original JSON response of target API. I’m not sure why, but I did not see any logging message that Tyk try something on the JSON response. Do you have any suggestion? Should I enable some feature to enable the response processors?

I have a question. I can modify form data request in body transform, because i need modify one field. I try modify so {{._tyk_context.request_data := 5}} but i get error from dashboard.