<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Method to check for invalid URLs in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8997#M3711</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://systematic.workato.com/t5/user/viewprofilepage/user-id/11450"&gt;@bedelman0731&lt;/a&gt;,&lt;BR /&gt;You can try using a &lt;STRONG&gt;execute python code action&lt;/STRONG&gt; which will take URL as input and StatusCode as output.&amp;nbsp;&lt;BR /&gt;Python code will make a request to the URL and captures the StatusCode&lt;BR /&gt;Based on the value of StatusCode you filter the URL from being added to the CSV.&lt;BR /&gt;Regards,&lt;BR /&gt;Prudvi&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2025 16:35:33 GMT</pubDate>
    <dc:creator>Prudvi</dc:creator>
    <dc:date>2025-02-27T16:35:33Z</dc:date>
    <item>
      <title>Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8996#M3710</link>
      <description>&lt;P&gt;Is there a method by which a URL can be checked within a recipe to see if the URL is valid?&lt;/P&gt;&lt;P&gt;I have a recipe that, among other things, is constructing a URL that should be a reference to an image based on one of the ID of a data element. The issue arises in that the image has not always been uploaded and the URL that should point to the image returns a 404 (Page Not Found).&lt;/P&gt;&lt;P&gt;The output of the recipe is a CSV file where each row contains what "should" be the URL to the image, but (in some cases) the image has not been uploaded and the URL that it would have then throws a 404.&lt;/P&gt;&lt;P&gt;I did find a App Script for Google Sheets that will check the URLs - but this requires importing the CSV into Google Sheets, adding in the App Script, adding a column that then uses the App Script function to return the status of the URL. All of these are additional steps that I would prefer to avoid and merely do the URL checking within the recipe itself.&lt;/P&gt;&lt;P&gt;Is there a way to implement such a URL checker into a recipe in Workato?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 16:00:02 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8996#M3710</guid>
      <dc:creator>bedelman0731</dc:creator>
      <dc:date>2025-02-27T16:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8997#M3711</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://systematic.workato.com/t5/user/viewprofilepage/user-id/11450"&gt;@bedelman0731&lt;/a&gt;,&lt;BR /&gt;You can try using a &lt;STRONG&gt;execute python code action&lt;/STRONG&gt; which will take URL as input and StatusCode as output.&amp;nbsp;&lt;BR /&gt;Python code will make a request to the URL and captures the StatusCode&lt;BR /&gt;Based on the value of StatusCode you filter the URL from being added to the CSV.&lt;BR /&gt;Regards,&lt;BR /&gt;Prudvi&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 16:35:33 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8997#M3711</guid>
      <dc:creator>Prudvi</dc:creator>
      <dc:date>2025-02-27T16:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8998#M3712</link>
      <description>&lt;P&gt;There's no need for Python. You can do this using the HTTP action. Set the HTTP action to treat non-2xx status codes as success and log the status code after the call. (Edit: Alternatively you can wrap the HTTP action in an error handler to catch non-2xx codes.)&lt;/P&gt;&lt;P&gt;If you want save tasks, you&lt;I&gt;&amp;nbsp;&lt;/I&gt;could&amp;nbsp;use Python or JS to loop through the URLs and return an array of results. If you're checking thousands of URLs this could save quite a few tasks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 16:51:03 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8998#M3712</guid>
      <dc:creator>gary1</dc:creator>
      <dc:date>2025-02-27T16:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8999#M3713</link>
      <description>&lt;P&gt;I think I will use a python code action to do this. While I am not proficient in writing Python code from scratch, I used ChatGPT to help me out to come up with the following function that appears to work. The input field is "input_data" and the output field is "Response"&lt;/P&gt;&lt;P&gt;In this usage, I only care about results that do not yield a 200 response&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests

def get_status_code(input_data):
    url = input_data.get("input_data", "").strip()  # Extract URL from input data
    
    if not url:
        return {"status_code": None}  # Ensure response is always a dictionary

    try:
        response = requests.get(url, allow_redirects=False)  # Similar to 'followRedirects': false
        return {"status_code": response.status_code}  # Return as dictionary for Workato mapping
    except requests.exceptions.RequestException:
        return {"status_code": None}  # Handle request errors safely

# Main function that Workato calls
def main(input_data):
    return get_status_code(input_data)  # Ensure output is always a dictionary&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 14:43:26 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/8999#M3713</guid>
      <dc:creator>bedelman0731</dc:creator>
      <dc:date>2025-02-28T14:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9001#M3714</link>
      <description>&lt;P&gt;I'm a big proponent of using basic Workato actions for basic operations. This is completely possible using native low-code actions, which are arguably easier to understand, implement, and maintain -- no ChatGPT required. As someone who is using a low-code automation platform&amp;nbsp;&lt;EM&gt;and doesn't know python&lt;/EM&gt;, I'm kind of flabbergasted by your approach, but to each his own I guess.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 18:34:46 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9001#M3714</guid>
      <dc:creator>gary1</dc:creator>
      <dc:date>2025-02-27T18:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9002#M3715</link>
      <description>&lt;P&gt;I get that completely - but I did not really see a way in which this could be done using Workato actions&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 20:25:37 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9002#M3715</guid>
      <dc:creator>bedelman0731</dc:creator>
      <dc:date>2025-02-27T20:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9034#M3720</link>
      <description>&lt;P&gt;I agree on using Workato actions whenever possible, but I didn't really find a good way to check a URL by doing so. What did you have in mind as a way to do this using basic Workato actions?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 14:44:43 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9034#M3720</guid>
      <dc:creator>bedelman0731</dc:creator>
      <dc:date>2025-02-28T14:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Method to check for invalid URLs</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9043#M3722</link>
      <description>&lt;P&gt;It's a two step process.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use the HTTP action to call the URL&lt;/LI&gt;&lt;LI&gt;Log the status code from the response&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's a closer look.&lt;/P&gt;&lt;P&gt;Two actions:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="url1.jpg" style="width: 922px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1886i50ED64502CA1ADF6/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="url1.jpg" alt="url1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Set up the HTTP action like the below. A GET request to a URL (you'll use a data pill since you'll be in a loop). Set the response type to "Text" so it doesn't try to parse the response (if it were set to JSON, it would crash).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="url2.jpg" style="width: 999px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1889i07A19A95E097F254/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="url2.jpg" alt="url2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Very important, set the below to "Yes". Usually when you receive a 404 the recipe will throw an error, but this will prevent the error and your recipe will continue.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="url3.jpg" style="width: 999px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1888i3AB6D8CF4D4A8892/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="url3.jpg" alt="url3.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this step, simply log the status code data pill from the output of the HTTP action. This could be in a list variable or really anywhere/anything else.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="url4.jpg" style="width: 512px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1887iADBCC5C543D4D224/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="url4.jpg" alt="url4.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the HTTP action output, a 200/success will look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="url5.jpg" style="width: 558px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1890i2E6DEACCEEFFEE93/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="url5.jpg" alt="url5.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And a 404 will look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="url6.jpg" style="width: 646px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1891iF95A53615EEB0EE8/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="url6.jpg" alt="url6.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 16:58:22 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/method-to-check-for-invalid-urls/m-p/9043#M3722</guid>
      <dc:creator>gary1</dc:creator>
      <dc:date>2025-02-28T16:58:22Z</dc:date>
    </item>
  </channel>
</rss>

