How to access attached file information via OData
Hello community,
I want to get the attached files information from a given case inside my environment. As the primary section containing the information is case, I know that I can retrieve the case information from
https://mycreatio.com/0/odata/Case
And the attached files can be extracted from
https://mycreatio.com/0/odata/CaseFile
Where each element from the response has the format:
{ "Id": "7bb283a4-2f30-7193-37f3-79c8465ceda4", "Name": "<value>", "CreatedOn": "<value>", "CreatedById": "<value>", "ModifiedOn": "<value>", "ModifiedById": "<value>", "ProcessListeners": 0, ... "Size": <value>, "CaseId": "<value>", "IsNeedToNotify": true, "SysFileStorageId": "<value>", "FileGroupId": "<value>", "Tag": "<value>" },
As you may see there is a field "CaseId" which is used to link the file object to the case object.
The problem I have is that I want to get the list of files from a case only by the Case Id. I've tried many different approaches using the OData standard syntax like:
'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq '<value>'
But I always get an error when trying to access the resource. In the previous example, the error I get is related to the field data type. Creatio yells because the CaseId field is of type Guid but in the comparison I am using a string.
By the way, changing the query to:
'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq guid'<value>'
or
'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq <value>
Doesn't fix the issue.
Can you please help me with this query that I am struggling to do?
Regards
Like
Rather than using CaseId, use Case/Id:
https://mycreatio.com/0/odata/CaseFile?$filter=Case/Id eq idvalueRyan
Rather than using CaseId, use Case/Id:
https://mycreatio.com/0/odata/CaseFile?$filter=Case/Id eq idvalueRyan
Ryan Farley,
Hello Ryan,
Is there a way in Odata to add an attachment to a Case Record?
Hello Anas Masa'deh,
You can check another of my community posts where I asked that same question:
- https://community.creatio.com/questions/how-upload-fileattachment-using-fileapiservice
- https://community.creatio.com/questions/get-error-403-denied-when-uploading-file-filepiservice
- https://community.creatio.com/questions/how-upload-attachments-odata
- https://community.creatio.com/questions/how-upload-fileattachment-using-dataservice-api
If you need more information you can check my personal project creatio-api-py where I have implemented the logic for file uploading to Creatio. You have the instructions needed for the implementation also explained in the issue #188.