Validity of URL in Control Rule Typology

Avatar

Avatar
Validate 10
Level 2
rahulg1930481
Level 2

Likes

7 likes

Total Posts

46 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
rahulg1930481
Level 2

Likes

7 likes

Total Posts

46 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
rahulg1930481
Level 2

05-12-2020

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

125 likes

Total Posts

329 posts

Correct reply

102 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

125 likes

Total Posts

329 posts

Correct reply

102 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile
_Manoj_Kumar
MVP

05-12-2020

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