Community
Showing results for 
Search instead for 
Do you mean 
Reply

Error in custom field update which contains Image via API

New Member
Posts: 6
Country: India

Error in custom field update which contains Image via API

[ Edited ]

I have field "record_creator_signature" which contains an image file. So, when I get that record from API.  

 

I got this against that field:

 

 

"record_creator_signature" => "System.Drawing.Bitmap"

 Now, Issue is when I tried to update the record via API (PUT request) I got below error: 

error_message : {message: "The request is invalid.", modelState: {record_creator_signature: [,…]}}
message: "The request is invalid." 
modelState: {record_creator_signature: [,…]}
record_creator_signature: [,…] 
         0:"Invalid Custom Field: does not accept the value 'System.Drawing.Bitmap' : invalid cast from 'system.string' to 'system.drawing.image'."

I checked an answer https://community.act.com/t5/Act-Premium-Web-API/Updating-Custom-Fields-via-the-API/m-p/332996#M327 here. According to link, I'll need to pass whole data to update the fields right?

If I don't pass that field then I'll lose that image and If I try to update the data as it is then I got above error. 

What should I do? or How can I skip updating that particular field in update? 

Please suggest.  Thanks.


 

Administrator
Posts: 1,312
Country: United_Kingdom

Re: Error in custom field update which contains Image via API

It looks like it's not possible to GET images from picture fields - the request just returns the string "System.Drawing.Bitmap".

You're right that as a PUT is a total record update, if you're not able to include the image in the request then the image will be lost in the record update.

I'll raise this with the API dev team to see if they have any solutions, or a timeline for a fix.
New Member
Posts: 6
Country: India

Re: Error in custom field update which contains Image via API

Thanks for reply JonTaylor. Please update me when if you get anything on the same.

 

Thank you.

Administrator
Posts: 1,312
Country: United_Kingdom

Re: Error in custom field update which contains Image via API

[ Edited ]

Hi Jimit,

The PATCH method mentioned in the post you linked has actually already been implemented, allowing partial updates of the record - meaning you don't have to supply the full record - and can leave out the image field.

 

If you haven't already, please make sure you're on the latest version of the API.


You can find out more about the PATCH method in the API swagger documentation by opening <yourserver>/act.web.api in a browser, then clicking API and looking under the contacts section for the available methods. Essentially you should be able to only update the fields you need to change, without worrying about fields that remain unchanged.

On top of this, the dev team has advised they're currently investigating ways to streamline the request flow when it comes to image fields in particular - as it's currently not intended for the GET request to return the "System.Drawing.Bitmap" string.