Discussions

Ask a Question
Back to all

create workorder with document by the REST API but the attchment does not show on the UI

Hi,

I am trying to use the rest api to create the workorder with the document as the attachment, and it was succeed:

API: {{theCorrigoHost}}api/v1/cmd/Workorder/Create

playload:

{  
    "Command": {  
        "WorkOrder": {  
            "Items": [  
                {  
                    "Asset": {  
                        "Id": 287840  
                    },  
                    "Task": {  
                        "Id": 30067  
                    },  
                    "Comment": "Test"  
                }  
            ],  
            "ContactName": "Kenny Wu",  
            "ContactAddress": {  
                "AddrTypeId": "Contact",  
                "Address": "".....  
            },  
            "TypeCategory": 4,  
            "SubType": {  
                "Id": 259  
            },  
            "Customer": {  
                "Id": 314  
            },  
            "RequestorContact": {  
                "Id": "562125"  
            },  
            "CustomerId ": 562125,  
           "Documents": [  
                {  
                    "Title": "Happy1",  
                    "Description": "Description of link. This is optional",  
                    "Comment": "Comment of link. This is optional",  
                    "IsShared": true,  
                    "IsPublic": false,  
                    "DocType": {  
                        "Id": 3  
                    },  
                    "CreatedBy": {  
                        "Id": 562125,  
                        "TypeId": "LeaseUser"  
                    },  
                    "ActorTypeId": "WO",  
                    "StorageTypeId": "Cloud",  
                    "Blob": {  
                        "Body": "werdwdsfwerfsdgvewrtwersdf",  
                        "FileName": "Happy.png"  
                    }  
                }  
            ]  
        },  
        "ComputeSchedule": true,  
        "ComputeAssignment": false  
    }  
}

and the Query API also can fetch the data with the document:
API: api/v1/query/WorkOrder

playload:

{  
    "QueryExpression": {  
        "Criteria": {  
            "Conditions": [  
                {  
                    "PropertyName": "Number",  
                    "Operator": "Equal",  
                    "Values": [  
                        "HSB-GB202801630"  
                    ]  
                }  
            ],  
            "FilterOperator": "And"  
        },  
        "Distinct": true,  
        "PropertySet": {  
            "Properties": [  
                "*",  
                "Documents.*",  
                "Documents.DocType.*",  
                "Customer.*",  
                "SubType.*",  
                "Specialty.*",  
                "LastAction.*",  
                "RequestorContact.*"  
            ]  
        },  
        "Count": 3000,  
        "FirstResultIndex": 0  
    }  
}

but there is not attachment in the UI, the UI just show the ticket without any attachment.

I also had tried Upload the document api with the existing workorder id, but still the same behavior, the query api can return the document, but UI only show the new created ticket, but no attachmen:
{{theCorrigoHost}}api/v1/base/Document


am I missing something? how to create/upload the attachment with the workorder by REST API and show it on the UI?


thanks,

Kenny.