Hello Everyone,
I have a question regarding API Path. Is API Path is similar to Request URL in Postman Collection?
For Example: /cats, /cats/:id
Hey @thefierycoder
Path variable (i.e. /:id
) is a part of a request URL and can be used when you want to be able to fetch a different resource based on the parameter (e.g. id).
In Postman, you can define path variables within the request URL:
This will automatically add Path variables section where you can specify its value:
For example, if I specify the value of 123, the actual request URL will be
postman.com/echo/123
in this case.
In addition, I think the following article is useful to understand the fundamental of it
Hope this helps! Let me know if you have further questions
1 Like
Hello @taehoshino
I know about path variables.
I found this statement Add default 200 response to all API paths. in this postman public workspace. Does it mean add pm.test to test script like this?
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
Hey @thefierycoder,
Yes, that is correct!
1 Like