Retrieving Mock ID via script

Since Adding a mock always generate a new ID (eg., is it possible to retrieve that ID and feed it into the environment variable somehow rather than just manually doing it ?
Any suggestions ?

Found it! You can use the postman API ( to get all the mocks and drill down to find the mockUrl you are looking for