Skip to main content
Level 3
Dec 5, 2020 5:10 PM UTC
Question

Validity of URL in Control Rule Typology

Hi All,

 

I have to check if a URL returns '200' response in the control rule typology. This control rule will be applied to the delivery before targeting. Is there any JS function to check whether a url is returning 200 response. My use case is to do this on the delivery, I am able to do this in the JS activity of workflow.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Manoj_Kumar
Community Advisor
Community Advisor
Dec 6, 2020 6:46 AM UTC

Hello @rahulg1930481 

 

You can try the use the HTTP client request method to check that.

 

Here is the sample code

var req = new HttpClientRequest('https://url.com/page-with-form'); req.method = 'GET'; req.execute(); var response = req.response; if(response.code != 200){ logError('Server returned not HTTP 200: HTTP', response.code, response.body); }

 

response.code will give you have HTTP status code for your request/url.

 

Thanks,

Manoj

Translate
Manoj  | https://themartech.pro