Solved

HTTP Caller POST To Add Attachment to Cityworks Work Order

  • 12 September 2022
  • 7 replies
  • 23 views

Badge +1

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 

 

 

 

 

 

icon

Best answer by birgit 16 September 2022, 13:07

View original

7 replies

Badge +6

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!

Badge +1

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

Badge +9

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.

Badge +1

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

Badge +1

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?

Badge +1

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.

Badge +1

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​ !

Reply