How to get Request details in request Transformer?

I have a requirement need to pass a Query parameter from request data.How to achive it?
postId:$((function()
local body,err,mimetype = kong.request.get_body()
return body.postId
end)())

I tried the above its not working any idea

Hi @aksvijayans,

A kong.request.get_body() will not provide the query params data. This will give you the request body. If you need to get the Query params try below code

URL: https://example.com?page=1&limit=10

Lua code:

condition = {}
for param_name, param_value in pairs(kong.request.get_query()) do
    table.insert(conditions, param_name .. " = " .. ngx.quote_sql_str(param_value))
end

Output:

{“page”:“1”, “limit”:“10”}