hi all, i am trying to generate a random- uuid and...
# general
v
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
The easiest way to do this at the moment is with the state extension
v
u mean writing java code or thru json itself ?
if java code... can u please share pointers or docs urls ?
thanks
l
v
thanks @Lee Turner @Tom
👍 1