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]))

Other articles of interest:

One Response to Create a new and random UUID for an API call

  • Anonymous says:

    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 *

Recent Comments