Skip to main content

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

.../services/Ams/Attachments/AddWorkOrderAttachment?

 

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?

 

image 

 

 

 

 

 

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.

Upload 

You might be interested in some of these suggestions and discussions about working with ArcGIS Online attachments:

 

We also have a custom transformer for sending a Work Order to Cityworks, in case you haven't seen it before!


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.

Upload 

You might be interested in some of these suggestions and discussions about working with ArcGIS Online attachments:

 

We also have a custom transformer for sending a Work Order to Cityworks, in case you haven't seen it before!

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.

 

imageI'm just unclear on how to use it properly


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.

 

imageI'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.


Hi do you have any follow up with how this went for you?

Makes a lot of sense. Appreciate you getting back to me so quick. Have a good one @bschabeniuk​ !


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.


Reply