Authentication options when uploading a file from MID Server PowerShell to ServiceNow

Risinkou1
Tera Contributor

Hi all,

I have a scenario where our MID Server is already connected to our ServiceNow instance successfully.

We're trying to upload a CSV file stored on the MID Server to a specific record in ServiceNow via PowerShell script on the MID Server by calling the Attachment REST API—something like this:

```powershell ... ```

$contentTypeHeader = "text/csv"
if (-not [string]::IsNullOrWhiteSpace($fileName_csv_new)) {
    $response = Invoke-RestMethod -Uri $instanceUrl_dataSource_new `
        -Proxy $proxy `
        -Headers @{
            "Authorization" = $authorizationHeader
            "Content-Type"  = $contentTypeHeader
        } `
        -Method Post `
        -InFile $filePath_new
}


In this code, we're using Basic authentication via the Authorization header.

My questions are:

  1. Besides Basic authentication, what other authentication methods can be used in this scenario when MID Server PowerShell uploads a file via REST to ServiceNow?

  2. If there are no other supported authentication mechanisms beyond Basic Auth, could someone confirm that as well?

Thank you for your help!

 
 

 

 

0 REPLIES 0