https://linen.dev logo
#general
Title
# general
v

vinod p

03/05/2024, 11:49 PM
hi all, i am trying to generate a random- uuid and use it in response and serveEventListeners. but it is not working. Can someone help out? This is the command used to start the wiremock
docker run -it --rm -p 8080:8080 --name wiremock wiremock/wiremock:3.3.1 --verbose --global-response-templating
and my mapping:
Copy code
{
    "request": {
        "method": "POST",
        "urlPattern": {{url_match_pattern}}
    },
    "response": {
        "status": 200,
        "headers": {
            "Content-Type": "application/json"
        },
        "jsonBody": {
            "request_id": "{{#assign 'ID'}}{{randomValue type='UUID'}}{{/assign}}{{ID}}"
        }
    },
    "serveEventListeners": [
        {
            "name": "webhook",
            "parameters": {
                "method": "POST",
                "url": "{{jsonPath originalRequest.query '$.callback_url'}}/{{request_id_two_str}}",
                "body": "{{ID}}",
                "delay": {
                    "type": "fixed",
                    "milliseconds": 5000
                },
                "headers": {
                    "Content-Type": "application/json"
                }
            }
        }
    ]
}
i am setting the variabl "ID" in response and using it in serveEventListeners. If this does not work, is there any other way out ?
@Tom @Lee Turner Any pointers or suggestions for this issue ?
t

Tom

03/06/2024, 1:54 PM
The easiest way to do this at the moment is with the state extension
v

vinod p

03/06/2024, 1:59 PM
u mean writing java code or thru json itself ?
if java code... can u please share pointers or docs urls ?
thanks
l

Lee Turner

03/06/2024, 1:59 PM
v

vinod p

03/06/2024, 2:00 PM
thanks @Lee Turner @Tom
👍 1
28 Views