https://linen.dev logo
#help
Title
# help
m

Muhammad Maaz Khalid

03/01/2024, 4:01 PM
Copy code
{
  "request": {
    "method": "POST",
    "urlPathPattern": "/orders",
    "headers": {
      "Content-Type": {
        "equalTo": "application/xml"
      },
      "Host": {
        "contains": "wiremock"
      }
    }
  },
  "response": {
    "status": 201,
    "body": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<OrderResponse>\n<Order>\n<id>{{parameters.orderId}}</id>\n<Quantity>{{parameters.quantity}}</Quantity>\n</Order>\n<OrderStatus>RECEIVED</OrderStatus>\n</OrderResponse>",
    "headers": {
      "Content-Type": "application/xml"
    },
    "transformers": [
      "response-template"
    ],
    "transformerParameters": {
      "orderId": "{{randomValue type='UUID'}}",
      "quantity": "${jsonPath request.body '$.Order.Quantity'}"
    }
  },
  "serveEventListeners": [
    {
      "name": "webhook",
      "parameters": {
        "method": "POST",
        "url": "<https://anywebhook.com/update>",
        "body": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<OrderResponse>\n<Order>\n<id>{{parameters.orderId}}</id>\n<Quantity>{{parameters.quantity}}</Quantity>\n</Order>\n<OrderStatus>COMPLETE</OrderStatus>\n</OrderResponse>"
      }
    }
  ]
}
Hi All Can you please guide what am I doing WRONG in transformerParameters to generate unique orderid using uuid. Also I want to use same order id in both response and web-hook call. Also the quantity that I received from request I want to place it in both response body and web hook body
Any suggestions?
4 Views