HTTP Request with condition

Hi All,

I am making a http request to an API which gives a pdf report as response but for some values that report pdf might not be available , so if I provide a default path in the resource property of the activity it still saves a blank pdf file which i dont want so is there a way i can add some condition to save only if a valid pdf report exists and not a blank one .

Thanks in advance.

Hi @Ritika_Singh ,
You can try invoke code
image
code
Dim myReq As System.Net.HttpWebRequest
Dim myResp As System.Net.HttpWebResponse

myReq = System.Net.HttpWebRequest.CreateHttp(“URL”)

myReq.Method = “GET”
myResp = DirectCast(myReq.GetResponse, System.Net.HttpWebResponse)
statusCode = myResp.StatusCode
statusDescription = myResp.StatusDescription
Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
myText = myreader.ReadToEnd

Regards,
LNV

Hi ,

Thank you for the response but my issue is not fetching the pdf my issue is that at time if there is no report still it save a blank pdf if I am using the resource path propert of the http request