Delete file from a file location on a midserver

_navin9898
Tera Expert

Dear members,

 

Good Day!

Could someone please let me know if it is possible to delete files from a file location on a mid server using flow designer? 

 

Best Regards,

Navin

1 ACCEPTED SOLUTION

Amit Gujarathi
Giga Sage

HI @_navin9898 ,
I trust you are doing great.

Yes, it is possible to delete files from a file location on a mid server using Flow Designer in ServiceNow. You can achieve this by leveraging the 'RESTMessageV2' API to interact with the mid server.

Here are the steps to delete files from a file location using Flow Designer:

  1. Create a new flow in Flow Designer.

  2. Add a 'REST step' to the flow.

  3. Configure the REST step with the following details:

    • Method: POST
    • Endpoint: Specify the URL of the mid server where the file is located.
    • Authentication: Provide the necessary credentials to access the mid server.
    • Headers: Set the 'Content-Type' header to 'application/json'.
    • Request Body: Construct the request body in JSON format. Include the file details (e.g., file name, path) and specify the action as 'delete'.
{
  "action": "delete",
  "file": "/path/to/file.txt"
}
  1. ave the REST step configuration.

  2. Continue building the flow with additional steps or actions as needed.

  3. Publish and activate the flow.

View solution in original post

2 REPLIES 2

Amit Gujarathi
Giga Sage

HI @_navin9898 ,
I trust you are doing great.

Yes, it is possible to delete files from a file location on a mid server using Flow Designer in ServiceNow. You can achieve this by leveraging the 'RESTMessageV2' API to interact with the mid server.

Here are the steps to delete files from a file location using Flow Designer:

  1. Create a new flow in Flow Designer.

  2. Add a 'REST step' to the flow.

  3. Configure the REST step with the following details:

    • Method: POST
    • Endpoint: Specify the URL of the mid server where the file is located.
    • Authentication: Provide the necessary credentials to access the mid server.
    • Headers: Set the 'Content-Type' header to 'application/json'.
    • Request Body: Construct the request body in JSON format. Include the file details (e.g., file name, path) and specify the action as 'delete'.
{
  "action": "delete",
  "file": "/path/to/file.txt"
}
  1. ave the REST step configuration.

  2. Continue building the flow with additional steps or actions as needed.

  3. Publish and activate the flow.

@Amit Gujarathi thank you for your reponse.