Issue Working with Files

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue Working with Files

L1 Bithead

Hello everyone,


I am having some trouble working with files in an incident.
I have integrated an API that need a path to upload a file.

This API checks the file extension in the path and as I have seen, file paths in XSOAR incidents are something like 80_916@80. I would need to have access to an absolute path or a way to get a path with the file name at the end of it.
Maybe exists a way to move a file to a specific path or something that could help me with this issue. I haven't found any documentation about this.


Could you help me?

Thanks in advance,



Are you referring to the XSOAR API, if so, which endpoint?







No, I am using an external API that I have implemented.



So you have an integration that is using an API from a 3rd party product and you would like to pass it an absolute file path?

That's exactly the point, sorry for my explanations.

OK, I understand.


In your integration, call the "demisto.getFilePath(<entryID>)" providing the entryID (which is the 123@123  reference). This will return a JSON dictionary with the key names "name" and "path". The name is the original filename and the path is the absolute path that can be used in opening a file handle.


For example:
273@6cf5026f-8199-45ab-80fc-199ddf3291ab is a zip file in my playground. When using demisto.getFilePath("273@6cf5026f-8199-45ab-80fc-199ddf3291ab")  I receive:


    "name": "",

    "path": "6cf5026f-8199-45ab-80fc-199ddf3291ab_273@6cf5026f-8199-45ab-80fc-199ddf3291ab" 



If I assigned the return value to "res" (for example), I can then use:


with open(res.get('path'), "rb") as fp:

    print(f"I have opened {res.get('name')} at {fp})






Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!