Sending a file attached to an Incident in SCSM to a third party application using REST web services in a PowerShell

jansi rani krishnan 601 Reputation points
2021-07-23T07:01:29.233+00:00

Hi Team,

I am working on an integration project, which has a requirement to send files attached to an incident from ITSSP to ServiceNow.

Currently, I know how to retrieve/download a file attached to an incident. But i would like to send the files to a third party ITSM tool.

I have tried sending Incident information (JSON format) to the third party tool using "Invoke-RestMethod" in a PowerShell code.

Now, I need some help in sending the files associated to an incident in SCSM to ServiceNow.

Appreciate your help!

Regards,
Jansi

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
212 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,446 questions
{count} votes

Accepted answer
  1. Andreas Baumgarten 102.2K Reputation points MVP
    2021-07-25T07:59:54.617+00:00

    Hi @jansi rani krishnan ,

    maybe this is helpful to get started:

    https://stackoverflow.com/questions/54438134/how-to-attach-csv-file-to-service-now-incident-via-rest-api-using-powershell (Last answer)
    or
    https://community.servicenow.com/community?id=community_question&sys_id=d3707023dbaceb8023f4a345ca961949

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


1 additional answer

Sort by: Most helpful
  1. Andreas Baumgarten 102.2K Reputation points MVP
    2021-08-06T16:07:22.967+00:00

    Hi @jansi rani krishnan ,

    the error message is clear: The remote server returned an error: (401) Unauthorized.

    Web request isn't authorized by the SNOW webservice.

    It's not a problem of the script but on the authorization or authentication against the SNOW webservice.
    The user authentication failed or the user dosesn't have the authorization to add the file?

    Just guessing. I don't know anything how SNOW is working.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments