<?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 Survey123 API usin python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1558357#M73183</link>
    <description>&lt;P&gt;Good day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to use the survey123 create report api to run some tests.&amp;nbsp; I am using the documentation found here&amp;nbsp;&lt;A href="https://developers.arcgis.com/survey123/api-reference/rest/report/#create-report" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/survey123/api-reference/rest/report/#create-report&lt;/A&gt;&amp;nbsp;to run a post request in python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below and gives me an error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;/P&gt;&lt;P&gt;# Define the parameters&lt;BR /&gt;survey_id = "4821fdadbd0f48c9b060615e9xxxx" # Replace with your actual Survey ID&lt;BR /&gt;template_item_id = "da82c957fe134248b356e899acxxxxx" # The ID of your report template item&lt;BR /&gt;token = "token"&lt;/P&gt;&lt;P&gt;# Authentication token from ArcGIS Online or your Portal&lt;/P&gt;&lt;P&gt;# Define the report request payload&lt;BR /&gt;payload = {&lt;BR /&gt;"f": "json",&lt;BR /&gt;"portalUrl": "&lt;A href="https://mygis/portal" target="_blank" rel="noopener"&gt;https://mygis/portal&lt;/A&gt;",&lt;BR /&gt;"queryParameters": {"objectIds":"532","orderByFields":"||last_edited_date DESC, objectid ASC"},&lt;BR /&gt;"templateItemId": template_item_id,&lt;BR /&gt;"outputReportName": "Test report",&lt;BR /&gt;"surveyItemId": survey_id,&lt;BR /&gt;"featureLayerUrl": "&lt;A href="https://prodgis.lla.com/server/rest/services/Hosted/service_891bd7a80776437781ca20e1e3a0be28/FeatureServer/0" target="_blank" rel="noopener"&gt;https://prodgis.lla.com/server/rest/services/Hosted/service_891bd7a80776437781ca20e1e3a0be28/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;"outputFormat": "docx", # or "docx"&lt;BR /&gt;"token": token&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Submit the report job request&lt;BR /&gt;url = f"&lt;A href="https://survey123.arcgis.com/api/featureReport/createReport/submitJob" target="_blank" rel="noopener"&gt;https://survey123.arcgis.com/api/featureReport/createReport/submitJob&lt;/A&gt;"&lt;BR /&gt;response = requests.post(url, data=payload)&lt;/P&gt;&lt;P&gt;# Process the response&lt;BR /&gt;if response.status_code == 200:&lt;BR /&gt;data = response.json()&lt;BR /&gt;if 'jobId' in data:&lt;BR /&gt;print("Report job submitted successfully!")&lt;BR /&gt;print("Job ID:", data['jobId'])&lt;BR /&gt;# Optionally, you can check the job status or get the result when complete&lt;BR /&gt;else:&lt;BR /&gt;print("Failed to submit report job:", data)&lt;BR /&gt;else:&lt;BR /&gt;print("Error submitting report job:", response.status_code, response.text)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error message&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Failed to submit report job: {'error': {'message': 'The "queryParameters" must include at least one of the following: "objectIds", "where", or "geometry".', 'code': '017'}, 'success': False}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2024 22:03:59 GMT</pubDate>
    <dc:creator>najeebhall</dc:creator>
    <dc:date>2024-11-13T22:03:59Z</dc:date>
    <item>
      <title>Survey123 API usin python</title>
      <link>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1558357#M73183</link>
      <description>&lt;P&gt;Good day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to use the survey123 create report api to run some tests.&amp;nbsp; I am using the documentation found here&amp;nbsp;&lt;A href="https://developers.arcgis.com/survey123/api-reference/rest/report/#create-report" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/survey123/api-reference/rest/report/#create-report&lt;/A&gt;&amp;nbsp;to run a post request in python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below and gives me an error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;/P&gt;&lt;P&gt;# Define the parameters&lt;BR /&gt;survey_id = "4821fdadbd0f48c9b060615e9xxxx" # Replace with your actual Survey ID&lt;BR /&gt;template_item_id = "da82c957fe134248b356e899acxxxxx" # The ID of your report template item&lt;BR /&gt;token = "token"&lt;/P&gt;&lt;P&gt;# Authentication token from ArcGIS Online or your Portal&lt;/P&gt;&lt;P&gt;# Define the report request payload&lt;BR /&gt;payload = {&lt;BR /&gt;"f": "json",&lt;BR /&gt;"portalUrl": "&lt;A href="https://mygis/portal" target="_blank" rel="noopener"&gt;https://mygis/portal&lt;/A&gt;",&lt;BR /&gt;"queryParameters": {"objectIds":"532","orderByFields":"||last_edited_date DESC, objectid ASC"},&lt;BR /&gt;"templateItemId": template_item_id,&lt;BR /&gt;"outputReportName": "Test report",&lt;BR /&gt;"surveyItemId": survey_id,&lt;BR /&gt;"featureLayerUrl": "&lt;A href="https://prodgis.lla.com/server/rest/services/Hosted/service_891bd7a80776437781ca20e1e3a0be28/FeatureServer/0" target="_blank" rel="noopener"&gt;https://prodgis.lla.com/server/rest/services/Hosted/service_891bd7a80776437781ca20e1e3a0be28/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;"outputFormat": "docx", # or "docx"&lt;BR /&gt;"token": token&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Submit the report job request&lt;BR /&gt;url = f"&lt;A href="https://survey123.arcgis.com/api/featureReport/createReport/submitJob" target="_blank" rel="noopener"&gt;https://survey123.arcgis.com/api/featureReport/createReport/submitJob&lt;/A&gt;"&lt;BR /&gt;response = requests.post(url, data=payload)&lt;/P&gt;&lt;P&gt;# Process the response&lt;BR /&gt;if response.status_code == 200:&lt;BR /&gt;data = response.json()&lt;BR /&gt;if 'jobId' in data:&lt;BR /&gt;print("Report job submitted successfully!")&lt;BR /&gt;print("Job ID:", data['jobId'])&lt;BR /&gt;# Optionally, you can check the job status or get the result when complete&lt;BR /&gt;else:&lt;BR /&gt;print("Failed to submit report job:", data)&lt;BR /&gt;else:&lt;BR /&gt;print("Error submitting report job:", response.status_code, response.text)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error message&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Failed to submit report job: {'error': {'message': 'The "queryParameters" must include at least one of the following: "objectIds", "where", or "geometry".', 'code': '017'}, 'success': False}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 22:03:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1558357#M73183</guid>
      <dc:creator>najeebhall</dc:creator>
      <dc:date>2024-11-13T22:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 API usin python</title>
      <link>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1558501#M73184</link>
      <description>&lt;P&gt;Is objectIds meant to be a list?&lt;/P&gt;&lt;P&gt;"objectIds": [532]&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 08:37:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1558501#M73184</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2024-11-14T08:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 API usin python</title>
      <link>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1564616#M73271</link>
      <description>&lt;P&gt;I'm not sure how you want to achieve this, but you might try using the arcgis API for python:&amp;nbsp;&lt;A href="https://developers.arcgis.com/survey123/guide/create-reports-using-the-arcgis-api-for-python/" target="_self"&gt;https://developers.arcgis.com/survey123/guide/create-reports-using-the-arcgis-api-for-python/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I found this to be much easier.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 12:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/survey123-api-usin-python/m-p/1564616#M73271</guid>
      <dc:creator>JamesTurner2</dc:creator>
      <dc:date>2024-12-04T12:33:36Z</dc:date>
    </item>
  </channel>
</rss>

