<?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: Add Attachments via python / service in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870473#M4620</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if I can do this....I would have to pass the image to the server...not sure how to do that....&lt;/P&gt;&lt;P&gt;Any thoughts would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Feb 2020 20:43:10 GMT</pubDate>
    <dc:creator>jaykapalczynski</dc:creator>
    <dc:date>2020-02-04T20:43:10Z</dc:date>
    <item>
      <title>Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870472#M4619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to research how to add attachments via Python.&lt;/P&gt;&lt;P&gt;I see something about Generating an Attachment Match Table and then Add Attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I eventually want to run this python script via a service&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I pass the service the local parameters to the image, identify the gdb etc from a mobile environment???&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where does this Match table come into play?&amp;nbsp; Would it reside on the mobile device?&amp;nbsp; PC?&amp;nbsp; Server?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure how this all plays together?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 20:39:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870472#M4619</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-02-04T20:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870473#M4620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if I can do this....I would have to pass the image to the server...not sure how to do that....&lt;/P&gt;&lt;P&gt;Any thoughts would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 20:43:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870473#M4620</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-02-04T20:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870474#M4621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What exactly do you want to do?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:14:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870474#M4621</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-04T21:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870475#M4622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to take a pic on my phone and store that pic on the phone.&lt;/P&gt;&lt;P&gt;Then fire off a GPService that is running a python script that adds the image to a Geodatabase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would have to upload the image and add it to a geodatabase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would have the Features Global ID and Object ID&lt;/P&gt;&lt;P&gt;I would have the image&lt;/P&gt;&lt;P&gt;I just need to pass the image somehow and Add the Attachment to the gdb&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:20:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870475#M4622</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-02-04T21:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870476#M4623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh cool. If your gdb is in your data store you should be able to write straight into it. The gp service you create should have 'allow uploads ticked' which should allow you to specify the path from your phone. This is from a portal perspective unfortunately tho.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:27:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870476#M4623</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-04T21:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870477#M4624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My Service is in ArcGIS Server not portal....can I still do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:33:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870477#M4624</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-02-04T21:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870478#M4625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do I have to create a Match Table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870478#M4625</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-02-04T21:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870479#M4626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm straying out of my comfort zone, but I would think you specify the match table in your tool, I.e a tool parameter would be the parcel ID then your attachment path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:56:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870479#M4626</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-04T21:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870480#M4627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yea I think that's where I am having my problem...do I create a match table every instance of adding an attachment?&amp;nbsp; Or one table that I reference each time I add an attachment?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2020 12:45:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870480#M4627</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2020-02-05T12:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870481#M4628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would have thought that you create the match table each time to reference your parcel id&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2020 18:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870481#M4628</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-05T18:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870482#M4629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would tackle this type of use case with using Feature Service Attachments functionality. Ie. creating a Feature Class "UserImages" to a gdb, publish a Feature Service with attachments enabled out and then using the out of the box tools/apis to handle the attachments.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Depending what kind of application you are building you are using, I would either use the APIs or REST-endpoint directly to add the attachment to the service. If you need to do some post-processing in between then using GP would provide one way to go.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this workflow you could store the image to the phone as you want and then upload it to a existing feature or most likely to create a new point (the location of the picture) and then add the attachment to that feature. The end result would be that you a new feature in your geodatabase with a location and the image. This way you can also add any other attributes to the features as well.&lt;/P&gt;&lt;P&gt;If you need more information on this flow, let me know and I can walk it through in more detail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2020 10:57:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870482#M4629</guid>
      <dc:creator>AnttiKajanus</dc:creator>
      <dc:date>2020-02-07T10:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachments via python / service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870483#M4630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you have a portal you can use arcgis python API to do it, sample here&amp;nbsp;Layer Attachments | ArcGIS for Developers&amp;nbsp;.&amp;nbsp; Also if you do not have access to portal you can use anything like this following code snippet to do this.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import os 
import requests 

url = "https://yourfeatureserviceurl" 
object_id = 1 
attachment = r"13291732970228.jpg"

files = {'attachment': (os.path.basename(attachment), open(attachment, 'rb'), 'application/jpeg')} 
params = { "f": "json", "token": "" }

r = requests.post( f"{url}/{object_id}/addAttachment", data=params, files=files ) 
r.json()


Sucessfull request will have this type of response

{'addAttachmentResult': {'objectId': 7, 'globalId': None, 'success': True}}&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 17:01:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-attachments-via-python-service/m-p/870483#M4630</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T17:01:31Z</dc:date>
    </item>
  </channel>
</rss>

