I am calling a REST API using postman and a Browser. Each gives me the same result but, I need know the how to identify which requests come from postman and which come from a browser. I need to stop hits from Postman.
I am calling a REST API using postman and a Browser. Each gives me the same result but, I need know the how to identify which requests come from postman and which come from a browser. I need to stop hits from Postman.
Add an additional identifier to Postman request - like Header.
Under Headers tab in Postman, click under New Key and write some name like myFlag, then under Value part set something like "postman"
You can pass other useful data in this manner. And for some servers you will need to setup stuff before you can use them, for example authorization tokens etc..
Now on the backend side (in part of code where you handle request for API in question) you should be able to read all headers including the one we added. Say if this one is present it's a postman open a new block with empty line or console block in it and set breakpoint to that line
Since you are the one making the Postman requests, there is a built in option under SETTINGS - GENERAL - HEADERS with a toggle for "Send Postman Token Header" and you could filter based on this specific header.
You could, of course, create a customer header as already mentioned as well and filter based on that. I am not sure if it is possible to STOP them since at the minimum you need to accept the request in order to filter it out.
Although not part of your question, if you are trying to stop someone else that is using Postman to call your API with Postman, you can try the toggle, but, of course, they can just turn off the toggle and you would not know where it came from.