How to handle dynamic GET requests

Hi,

I’m trying to automate the following user creation flow within my app:

When the user performs a POST request to the endpoint /user/create

The application will trigger several GET requests e.g.:
GET /resources/1234
GET /assest/9876

The problem is the I am unable to know what the ids ‘1234’ and ‘9876’ beforehand since I cannot see it within the preceding requests so I have nothing I correlate/scrape. How do I handle such cases?

Hi @ryanrosello-og

Welcome to the community forum :wave:

For this scenario I believe correlation and dynamic data should help. Assuming the initial POST request returns those values, you can recover the ids from the response (1234, 9876, etc) and pass it on to the subsequent requests. If the POST request does not return those values, you will probably have to investigate how those are triggered (e.g. if in a browser, investigate the network activity using developer tools), to have the k6 script do the same.

For the metrics, in this situation, you might want to have a look at grouping urls under one tag.

If this does not help, kindly provide a bit more context of how your endpoint informs of the ids. Maybe a request to another endpoint to get the details for the created user, using the cookies, etc.? And we can further advice.

Cheers!

thanks for your response, I will look into your suggestions

1 Like