Is it possbile to take data from a prviousstep and add to the URL I need to take an Id from a prvious step and add it as the last part of the url
Testscenario Get with data from previous step
Hi, Let’s clarify a couple of points to help resolve this:
-
Ensure that you are running the entire scenario to see the variable replacement :
The {{$.stepId.xx}} is a temporary variable that can only be accessed when the entire scenario is run. If you are debugging a single step, this variable will not be available because there is no context for it. -
Checking the Expression:
If you are running the entire scenario and still encountering issues, it might be due to an incorrect expression.
Please provide the following details:
The response content from the previous step.
The exact expression you are using in the second step (e.g., {{$.stepId.response.body.token}}).
This information will help us quickly identify and resolve the issue.
If you have any further questions or need more detailed guidance, please let me know.
You can handle this in ApiDog by setting the variable part of the URL as a path parameter. For example, you defined the url /items/{extractedId}
. Then, you can see a path param,and you just need to define the value for this parameter.
Here are two methods you can use:
- Using Variables
Extract the ID from the response of the first step and store it as a variable.
In subsequent steps, use {{variableName}} to reference the value. - Using “Retrieve Pre-Step Data”
You can directly reference data from previous steps using a syntax like {{$.stepId.response.body.token}}.
here is the help dochttps://docs.apidog.com/pass-data-between-requests-601617m0#retrieve-pre-step-data
If you have any further questions or need more detailed guidance, please let me know.
I did the step {{$.stepid…. and that didn’t get replaced but I will try again thought that it wasn’t supported
the step before this is a if within a loop before that
Thank you for your feedback! Just to clarify, the step 3 you mentioned is a loop step, correct? Because if
step cannot be referenced.
As shown in the example below, when we use path parameters and directly referenced variables to refer to the parameters of the loop step, everything works fine in our tests.
To help us resolve your issue more effectively, could you please provide the following details:
- The version number of ApiDog that you are using.
- Additional reproduction information, including specific testing scenarios and steps.
This information will assist us in quickly pinpointing the problem.
Thank you for your patience!
I’m using 2.6.47
I didn’t know I needed to add {P1} in the URL to show the path param option
It works now, perhaps an improvement that it’s visible all the time.