Access the job id of the monitor

I want to access the data of the job in the monitor. Is there any way to access the job ID of the jobs that had already run.

Hi @Dilleswar.tudip! We don’t store the jobId response data for monitor runs. One option to configure this would be to run your monitors via the Postman API in a tool like Newman with a cron job. You’d then be able to add a log under “Tests” to save that jobId data as desired.

If that method isn’t ideal for your workflow, we’re happy to take this as a Feature Request — when you have a moment could you please submit it along with your use case so that we can better understand its potential impact?

2 Likes

Thanks for the response. I am using postman API to run the monitor by posting a request. I need to access back the data by get request with the job id. As per my knowledge Newman is useful for running the collection with the specified environment.

Is it possible to run a monitor through the Newman? If possible, suggest me a way to do it and also how to get the job id of the monitor.

It’s possible to run a monitor using Newman, however the ideal workflow depends on your scenario.
Two options I’m thinking of:

  1. If you check out our Postman API, you’ll be able to make a request to Run a Monitor. All you’ll need is an API key and the monitor_uid, the first you can get using the instructions in the “Overview” section and the second you can retrieve with a GET to All Monitors.

    You’ll just need to run a single request if you’re only using one monitor, so that doesn’t need to be a whole collection. Instead, I’d create a cron job script outside of Newman/Postman to run that monitor and pull the jobId from the response into a file.

  2. Another option would be to create your own monitor rather than run it through Postman. Using Newman, you can Run a Collection, then save the jobId from the response. As this is outside of our monitoring tool, it won’t count towards your usage limits.

My main motto to access the job id while running the monitor is, I am facing “Run appears to have hung, retrying” error and the post request fail to get back the run result. so, I am am trying to get back the result of the run using get request of monitor but it is giving me the previous run result.