<?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: How could we verify service urls from json file  whether available or not in arcgis portal using python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068224#M6198</link>
    <description>&lt;P&gt;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can use the following script to get the existing portal services in a list. Then compare it with the url list from json.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS

gis = GIS("portal url", username, password, verify_cert=False)

# for feature layers 
fcs = gis.content.search("*", item_type="Feature Layer", max_items=100)
portal_service_urls = [fc.url for fc in fcs]
.....
json_urls = [...]

# Compare the 2 lists
set(portal_service_urls) &amp;amp; set(json_urls)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that helps.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jun 2021 01:21:00 GMT</pubDate>
    <dc:creator>MehdiPira1</dc:creator>
    <dc:date>2021-06-15T01:21:00Z</dc:date>
    <item>
      <title>How could we verify service urls from json file  whether available or not in arcgis portal using python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068046#M6194</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;My requirement is need to verify the urls given by some external users in json file. i need to load the json and read urls from it , need to verify whether service urls exists or not in portal using arcgis python api.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 17:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068046#M6194</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-06-14T17:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: How could we verify service urls from json file  whether available or not in arcgis portal using python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068053#M6195</link>
      <description>&lt;P&gt;moved to&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/bd-p/arcgis-api-for-python-questions" target="_blank"&gt;ArcGIS API for Python Questions - Esri Community&lt;/A&gt;&amp;nbsp;to give you a better chance of getting an answer&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 18:16:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068053#M6195</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-14T18:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: How could we verify service urls from json file  whether available or not in arcgis portal using python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068058#M6196</link>
      <description>Thank you Dan &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Jun 2021 18:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068058#M6196</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-06-14T18:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: How could we verify service urls from json file  whether available or not in arcgis portal using python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068128#M6197</link>
      <description>&lt;P&gt;If you only need to check the existence of the endpoint URLs in the json, you could do something like this with a simple GET request. A HEAD request is also an option, but results can be unreliable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests

def url_exists(url):
    req = requests.get(url)
    if req.status_code == 200:
        print('Endpoint exists')
        return True

...
for url in your_json['endpoints']:
   url_exists(url)
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 20:56:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068128#M6197</guid>
      <dc:creator>jas_eagle</dc:creator>
      <dc:date>2021-06-14T20:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: How could we verify service urls from json file  whether available or not in arcgis portal using python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068224#M6198</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can use the following script to get the existing portal services in a list. Then compare it with the url list from json.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS

gis = GIS("portal url", username, password, verify_cert=False)

# for feature layers 
fcs = gis.content.search("*", item_type="Feature Layer", max_items=100)
portal_service_urls = [fc.url for fc in fcs]
.....
json_urls = [...]

# Compare the 2 lists
set(portal_service_urls) &amp;amp; set(json_urls)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jun 2021 01:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-could-we-verify-service-urls-from-json-file/m-p/1068224#M6198</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-06-15T01:21:00Z</dc:date>
    </item>
  </channel>
</rss>

