when hit the API in postman then this error comes-
{
"code": 100,
"message": "Error: Unexpected value for attribute 'contents': Null not allowed: issues = {0=>Unexpected value for attribute 'contents': Null not allowed}, class = Attachment, id = "
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
how to upload multiple Attachment through API
You'd need to encode the contents, then send it.
https://www.itophub.io/wiki/page?id=3_1_0:advancedtopics:rest_json_attachment
Hi @jeffrey
this is my json format plz check it
{
"operation": "core/create",
"comment": "Upload file",
"class": "Attachment",
"fields": {
"item_id": 70,
"item_class": "WOrder",
"contents":{
"contents_data":{
"data": "base64convertedfile",
"mimetype": "text/rtf",
"filename": "filename.rtf"
},
"contents_data":{
"data": "base64convertedfile",
"filename": "filename1.docx",
"mimetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
}
}
}
Last edit: Rahul Babu 2024-05-16
I believe your structure is wrong.
Try
This is also not working
when hit the API in postman then this error comes-
{
"code": 100,
"message": "Error: Unexpected value for attribute 'contents': Null not allowed: issues = {0=>Unexpected value for attribute 'contents': Null not allowed}, class = Attachment, id = "
}