Discussions

Ask a Question
Back to All

Add Attachment to a Work Order using API

I'm trying to make an API call to add an attachment to a work order and getting the below error.

ValidationErrors:Array[2]
0:Object
Message:"Could not create an instance of type System.IO.Stream. Type is an interface or abstract class and cannot be instantiated. Path 'File.InputStream.identity', line 10, position 19."
ErrorType:"IncorrectType"
FieldName:"request.File.InputStream.identity"
1:Object
Message:"The field File is reqired, but missing or empty."
ErrorType:"Mandatory"
FieldName:"request.File"
Message:"Model data validation failed"
Code:2100
MessageId:"1"

In below mentioned JSON format where I need to pass the file URL or path

"MessageVisibility": "All",
"Name": "Nikon-D500-Sample-Images-2.jpg",
"MimeType": "image/jpg",
"DocumentType": "Picture",
"File": {
"ContentLength": 0,
"ContentType": "image/jpg",
"FileName": "Nikon-D500-Sample-Images-2.jpg",
"InputStream": {
"__identity": {}
}
},
"ConcurrencyId": 0,
"PerformedBy": {
"Name": "Raviteja"
},
"WorkOrderId": 3352362,
"MessageId": "1"