lurims
Enthusiast
Enthusiast

Can vRO help to test a website page is running

I would like to write a vro script that continuously checks if a website is up and running all the time.  Tried with vRO 8 but I got certificate error.  Anyone has already did this?  If so, could you share the idea/code?  I have tried with http get object in vRO, it did not work.

//Auto-generated script

var urlObject = new URL(url);
result = urlObject.getContent() ;
 
0 Kudos
2 Replies
bdamian
Expert
Expert

You need to import the certificate first. You have a workflow for that. But, why an action instead of a workflow scheduled to run every 10 minutes or so?

---
Damián Bacalov
vExpert 2017-2018-2019-2020-2021-2022
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
rwk1982
Enthusiast
Enthusiast

Hello!

You could use a "TransientHost" from the RESTHostManger:

var http_host = "https://yourhost.fq.dn"
var http_uri = "index.html"

var restHost = RESTHostManager.createHost("dynamicRequest")
restHost.setAutoUrlRedirect(true)
var http_resthost = RESTHostManager.createTransientHostFrom(restHost)

http_resthost.url = http_host
http_resthost.connectionTimeout = 900
http_resthost.operationTimeout = 900
//ignore cert
http_resthost.hostVerification = false

var method = "GET"
var body = ""
var request = http_resthost.createRequest(method, http_uri, body)
//example - add header
//request.setHeader("Content-Type", "application/json")

var response = request.execute()
var result = response.contentAsString

return result

 

Drink coffee.. Do stupid things faster with more energy...