Create a new and random UUID for an API call

When working with an API call, it may be necessary to create a new and valid UUID. This can actually be accomplished in a single line of code.

def order_id = UUID.randomUUID().toString()

This can be sent to the API object as a variable

mydate = new Date()
def order_id = UUID.randomUUID().toString()

//Initialize Order
initialize_order = WS.sendRequest(findTestObject('Initialize Order',
    [('order_id') : order_id,
    ('date') : mydate]))

Author Signature for Posts

1 thought on “Create a new and random UUID for an API call

    • Author gravatar

      Hi !

      I found this blog few weeks ago and it’s really helping me out with my tests!
      Thanks a lot for the Katalon tips and tricks !

      Keep up the good work 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.