Hello Again
In my Environment I set a variable var = 1 and use that one in the URL
Now my put operation yields an issue: 1 Issue found while validating against PUT /api/workspace/{workspaceId}
When I change the URL to /api/workspace/:workspaceId and use a path variable, the test is successfull
Is there a way to use the environment vars in those tests?
Even when using the URL with :workspaceId and setting the path variable workspaceId to the environment variable {{workspaceId} the test fails
I somehow don’t want to use local variables for tests, especialy when chaining them
My bad - When people talk about variables, my mind instantly goes to getting or setting them via a script with pm.environment.get() / pm.environment.set()
So it’s failing to validate the request against your schema when you use an environment variable as a path parameter value?
Okay. Not totally sure what you are trying to do and why it is or isn’t working, but from the images, it looks like you should “stick” with the path vars, but combine it with the {{workingId}} you add by putting that as the value for the path var.
This one is showing using the dynamic vars for a uuid:
One thing to note, if you want to have your example use the value you pass on one of the postman mock server instances, you need to change the url value of your example to use a variable, like this: {{url}}/workspaces/{{workspaceid}}
that way it can be used as a substitution in the response with "{{workspaceid}} on the mock server like this:
For requests from within a Collection, this approach (using a path variable and setting it to the environment var) is working fine and all the calls and tests are successfull
The problem-part is when i test or validate the API.
On the postman website I go into my API and from there to Test
Then I see the test-suite that I created (the collection). If I validate the API schema against it, I get the error mentioned.
It looks like when I test the API, the environment is “ignored” or no environment is used.
Unfortunately my problem is still not solved. I’m getting the feelding, that my question/problem is not clear
I have six request in my Collection
/login
/user/create
/user/read/:userId
/user/change/:userId
/user/delete/:userId
/user/read/:userId
when loggin in, the accessToken is saved as an environment variable
when creating an user, the response is the userId, which is also saved as an environment variable
when reading the object, the PathVariable is set to the environment Variable