Im trying to work with the Cityworks API to create Work Orders using FME desktop.
I used the http caller to create the Work order and populate the necessary fields. However, my next challenge is to upload an attachment to the Work Order that comes from the attachment in the AGOL feature Layer created from Survey123. To do that I have used another HTTP caller set to POST with the URL
I know I have the Query string correct but I'm doing something wrong in the Multipart Upload section. Also, Do I need to use a token if I'm using a web connection for Authentication?
Best answer by birgit
bschabeniuk wrote:
Thanks for the input. I am able to attach files from my local drive. However, my goal is to take the attachments from an AGOL feature service and attach them to the Cityworks Work Order. the 'arcgisonline_attachment{0}.data' attribute holds the data from the attachment.
I'm just unclear on how to use it properly
I never succeeded in to get this to work. Instead I use a workaround with for example an AttributeFileWriter to save the data to a file and then send the file via multi-part upload. Maybe you can combine this with a TempFilePathCreator to write the file, send it and then automatically remove it after your workbench has finished running.
I noticed that an attribute is used for the Value parameter in the Multi-Part upload. The POST request will fail if this attribute does not contain valid data. In this workflow, what is the value of the the arcgisonline_attachment{0} attribute?
In the following example, I am uploading a file from my local computer to a Cityworks attachment. The Value parameter contains a file path to that file. I've also set the MIME Type as "application/octet-stream" for a PDF file.
You might be interested in some of these suggestions and discussions about working with ArcGIS Online attachments:
I noticed that an attribute is used for the Value parameter in the Multi-Part upload. The POST request will fail if this attribute does not contain valid data. In this workflow, what is the value of the the arcgisonline_attachment{0} attribute?
In the following example, I am uploading a file from my local computer to a Cityworks attachment. The Value parameter contains a file path to that file. I've also set the MIME Type as "application/octet-stream" for a PDF file.
You might be interested in some of these suggestions and discussions about working with ArcGIS Online attachments:
Thanks for the input. I am able to attach files from my local drive. However, my goal is to take the attachments from an AGOL feature service and attach them to the Cityworks Work Order. the 'arcgisonline_attachment{0}.data' attribute holds the data from the attachment.
Thanks for the input. I am able to attach files from my local drive. However, my goal is to take the attachments from an AGOL feature service and attach them to the Cityworks Work Order. the 'arcgisonline_attachment{0}.data' attribute holds the data from the attachment.
I'm just unclear on how to use it properly
I never succeeded in to get this to work. Instead I use a workaround with for example an AttributeFileWriter to save the data to a file and then send the file via multi-part upload. Maybe you can combine this with a TempFilePathCreator to write the file, send it and then automatically remove it after your workbench has finished running.
Thanks, that worked well. I'm still going to keep trying to find a way to directly attach the AGOL data file to the Cityworks Work Order when I have time. But for now, this is a great solution. Thanks again
Thanks, that worked well. I'm still going to keep trying to find a way to directly attach the AGOL data file to the Cityworks Work Order when I have time. But for now, this is a great solution. Thanks again
Hi do you have any follow up with how this went for you?
Hi do you have any follow up with how this went for you?
I never pursued finding a way to directly attach the AGOL data file to the Cityworks Work Order. Writing to a temporary on the FME server that is overwritten with each new attachment file works very well so there was no need to spend time finding another solution.
Thanks, that worked well. I'm still going to keep trying to find a way to directly attach the AGOL data file to the Cityworks Work Order when I have time. But for now, this is a great solution. Thanks again
The key item here is to review the documentation for the add attachment of Cityworks API or any API for that matter, and determine what is the required and supported formats . If its looking for a file, then there is no way to use the blob directly, which is similar to geodatabases. AGOL and Portal Add attachment API is similar to CityWorks - you can only add a file.
Hi @bschabeniuk, I’m trying to do something similar, just with adding an attachment to a service request rather than a work order. It’ll run in flow. The file is dynamic, since the workspace will be triggered by a survey response with an attachment. So far I’ve been able to write the file to a folder in Flow. I’m not sure what the next steps are though, how to reference this file in the http caller? I had used the path reader to supply the value, but that didn’t work.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.