dear Mr
i have to learn about api and tray to get it
i have collection from friend
https://www.postman.com/collections/94db931dc503afd508a5
and when tray to post get error 404 ?
and the next ?
POST http://{{url}}login/
Error: DNSLookup: EBADNAME {{url}}login
Network
- agent: “Cloud Agent”
Request Headers
lang: ar
Content-Type: application/json
User-Agent: PostmanRuntime/7.44.0
Accept: /
Cache-Control: no-cache
Postman-Token: 138d1cb4-da82-4809-9565-89c7b152bf56
Host: {{url}}login
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Request Body
can you help me
by any chance did you forgot to define {{url}} variable ??
In Postman, {{url}}
is a variable placeholder. That means Postman is expecting you to define what {{url}}
actually is (like http://127.0.0.1:8000
or your hosted domain).
But right now, Postman doesn’t know what {{url}}
means — so it’s literally trying to request http://{{url}}login
, which is invalid (hence the DNS error).
so you need to define the {{url}} for your collection
tell me if you need the guidance for how to define it
thank you
can you help me to get the guidance for how to define it
sure,
1st method :
you can remove http://{{url}} and place your domain for every request manually.
2nd method : set as environment variable
- select Environments in the sidebar and select an environment.
- To add a new variable, select the bottom row of the table and enter a Variable name. which will be in your case url and value will be 127.0.0.1:8000/ (since http: is already added in your request we will not add that over here and don’t forgot to add the ‘/’ after your value)
3rd method : set as global or collection variable
- you can either set as global variable this variable will be set as globally
- you can set it as collection variable this variable will only be available in only this collection
- values and variable name will be same as above
if you still get the error let me know
I personally suggest you to go with global variable also suggest you that if it is possible remove the http:// from your request (avoid typing it manually in every request) instead add that with this variable like this https:://127.0.0.1:8000/ all together
here, official document link : Store and reuse values using variables | Postman Docs