No output from Invoke-RestMethod where as there was an output in PostMan tool

I’ve used PostMan tool to test an API URL from our API provider and it generated the expected output but when I use Invoke-RestMethod to consume the API it does not get the expected result. In fact the command gets “”.

Below is the invoke-restmethod command and the DEBUG output:

Set-PSDebug -Trace 2
Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression {$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(“X-SFAPI-Account”, “philippinedemo”)
$headers.Add(“X-SFAPI-AppName”, “sfapidemo”)
$headers.Add(“X-SFAPI-RSAKey”, “MI//////////////////////////////////////////////////////////////////////////////////////6jCCA--------------------------------------++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++±-----------------------HDAdKYWthcnRhMRgwFgYDVQQK#########################################################1UEAwwCNjAxNjA0Bgkqhki%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5tdXN0aWthQGRhdGFvbi5jb20wMzEyMj*****************************************************************************************************************************************************************************gXsdzFdGD6wAQ9dg2Qzr2H0K/aNef4463DOET================================================================================================================3g0Ri)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))Gacx82y3Vko”)
$headers.Add(“Cookie”, “JSESSIONID=F503511AF058F7DC5EC44967845F614D; LASTSESSIONFROM=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LASTSESSIONTO=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LSESSIONID=DEVLC-184”)
$response = Invoke-RestMethod ‘https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd’ -Method ‘GET’ -Headers $headers -MaximumRedirection 0
$response | ConvertTo-Json} -PSHost

DEBUG

DEBUG: 1+ >>>> Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression {$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”

DEBUG: ! CALL function ‘’
DEBUG: 1+ Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression >>>> {$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”

DEBUG: ! CALL function ‘’
DEBUG: 1+ Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression { >>>> $headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”

DEBUG: 2021-10-12 08:33:18.0261 ParameterBinderController Information: 0 : WriteLine Argument count: 1
DEBUG: 2021-10-12 08:33:18.0266 ParameterBinding Information: 0 : BIND NAMED cmd line args [New-Object]
DEBUG: 2021-10-12 08:33:18.0270 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [New-Object]
DEBUG: 2021-10-12 08:33:18.0272 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary[[String],[String]]] to parameter [TypeName]
DEBUG: 2021-10-12 08:33:18.0278 ParameterBinding Information: 0 : Executing VALIDATION metadata: [System.Management.Automation.ValidateTrustedDataAttribute]
DEBUG: 2021-10-12 08:33:18.0284 ParameterBinderBase Information: 0 : WriteLine Validation attribute on TypeName returned False.
DEBUG: 2021-10-12 08:33:18.0372 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary[[String],[String]]] to param [TypeName] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.0391 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = Net
DEBUG: 2021-10-12 08:33:18.0399 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = Net
DEBUG: 2021-10-12 08:33:18.0403 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [New-Object]
DEBUG: 2021-10-12 08:33:18.0421 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-10-12 08:33:18.0426 TypeConversion Information: 0 : Converting “System.Collections.Generic.Dictionary[[String],[String]]” to “System.Type”.
DEBUG: 2021-10-12 08:33:18.0434 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ! SET $headers = ‘System.Collections.Generic.Dictionary`2[System.String…’.
DEBUG: 2+ >>>> $headers.Add(“X-SFAPI-Account”, “philippinedemo”)

DEBUG: 3+ >>>> $headers.Add(“X-SFAPI-AppName”, “sfapidemo”)

DEBUG: 4+ >>>> $headers.Add(“X-SFAPI-RSAKey”, “MI//////////////////////////////////////////////////////////////////////////////////////6jCCA--------------------------------------++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++±-----------------------HDAdKYWthcnRhMRgwFgYDVQQK#########################################################1UEAwwCNjAxNjA0Bgkqhki%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5tdXN0aWthQGRhdGFvbi5jb20wMzEyMj*****************************************************************************************************************************************************************************gXsdzFdGD6wAQ9dg2Qzr2H0K/aNef4463DOET================================================================================================================3g0Ri)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))Gacx82y3Vko”)

DEBUG: 5+ >>>> $headers.Add(“Cookie”, “JSESSIONID=F503511AF058F7DC5EC44967845F614D; LASTSESSIONFROM=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LASTSESSIONTO=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LSESSIONID=DEVLC-184”)

DEBUG: 6+ >>>> $response = Invoke-RestMethod ‘https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd’ -Method ‘GET’ -Headers $headers -MaximumRedirection 0

DEBUG: 2021-10-12 08:33:18.0871 ParameterBinderController Information: 0 : WriteLine Argument count: 7
DEBUG: 2021-10-12 08:33:18.0926 ParameterBinding Information: 0 : BIND NAMED cmd line args [Invoke-RestMethod]
DEBUG: 2021-10-12 08:33:18.0946 ParameterBinding Information: 0 : BIND arg [GET] to parameter [Method]
DEBUG: 2021-10-12 08:33:18.0952 ParameterBinding Information: 0 : COERCE arg to [Microsoft.PowerShell.Commands.WebRequestMethod]
DEBUG: 2021-10-12 08:33:18.0970 ParameterBinding Information: 0 : Trying to convert argument value from System.String to Microsoft.PowerShell.Commands.WebRequestMethod
DEBUG: 2021-10-12 08:33:18.1020 ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-10-12 08:33:18.1030 TypeConversion Information: 0 : Converting “GET” to “Microsoft.PowerShell.Commands.WebRequestMethod”.
DEBUG: 2021-10-12 08:33:18.1034 TypeConversion Information: 0 : Calling case sensitive Enum.Parse
DEBUG: 2021-10-12 08:33:18.1038 TypeConversion Information: 0 : Enum.Parse Exception: “Requested value ‘GET’ was not found.”.
DEBUG: 2021-10-12 08:33:18.1042 TypeConversion Information: 0 : Calling case insensitive Enum.Parse
DEBUG: 2021-10-12 08:33:18.1046 ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [Get]
DEBUG: 2021-10-12 08:33:18.1050 ParameterBinding Information: 0 : BIND arg [Get] to param [Method] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1052 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary2[System.String,System.String]] to parameter [Headers] DEBUG: 2021-10-12 08:33:18.1058 ParameterBinding Information: 0 : COERCE arg to [System.Collections.IDictionary] DEBUG: 2021-10-12 08:33:18.1063 ParameterBinding Information: 0 : Trying to convert argument value from System.Management.Automation.PSObject to System.Collections.IDictionary DEBUG: 2021-10-12 08:33:18.1069 ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo DEBUG: 2021-10-12 08:33:18.1079 TypeConversion Information: 0 : Converting "System.Collections.Generic.Dictionary2[System.String,System.String]" to “System.Collections.IDictionary”.
DEBUG: 2021-10-12 08:33:18.1081 TypeConversion Information: 0 : Result type is assignable from value to convert’s type
DEBUG: 2021-10-12 08:33:18.1085 ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [System.Collections.Generic.Dictionary2[System.String,System.String]] DEBUG: 2021-10-12 08:33:18.1091 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary2[System.String,System.String]] to param [Headers] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1095 ParameterBinding Information: 0 : BIND arg [0] to parameter [MaximumRedirection]
DEBUG: 2021-10-12 08:33:18.1098 ParameterBinding Information: 0 : COERCE arg to [System.Int32]
DEBUG: 2021-10-12 08:33:18.1102 ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-10-12 08:33:18.1105 ParameterBinding Information: 0 : Executing VALIDATION metadata: [System.Management.Automation.ValidateRangeAttribute]
DEBUG: 2021-10-12 08:33:18.1171 ParameterBinderBase Information: 0 : WriteLine Validation attribute on MaximumRedirection returned False.
DEBUG: 2021-10-12 08:33:18.1182 ParameterBinding Information: 0 : BIND arg [0] to param [MaximumRedirection] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1186 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Invoke-RestMethod]
DEBUG: 2021-10-12 08:33:18.1190 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to parameter [Uri]
DEBUG: 2021-10-12 08:33:18.1193 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to param [Uri] SKIPPED
DEBUG: 2021-10-12 08:33:18.1197 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to parameter [Uri]
DEBUG: 2021-10-12 08:33:18.1200 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to param [Uri] SKIPPED
DEBUG: 2021-10-12 08:33:18.1203 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to parameter [Uri]
DEBUG: 2021-10-12 08:33:18.1207 ParameterBinding Information: 0 : COERCE arg to [System.Uri]
DEBUG: 2021-10-12 08:33:18.1209 ParameterBinding Information: 0 : Trying to convert argument value from System.String to System.Uri
DEBUG: 2021-10-12 08:33:18.1214 ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-10-12 08:33:18.1218 TypeConversion Information: 0 : Converting “https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd” to “System.Uri”.
DEBUG: 2021-10-12 08:33:18.1222 ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd]
DEBUG: 2021-10-12 08:33:18.1227 ParameterBinding Information: 0 : Executing VALIDATION metadata: [System.Management.Automation.ValidateNotNullOrEmptyAttribute]
DEBUG: 2021-10-12 08:33:18.1232 ParameterBinderBase Information: 0 : WriteLine Validation attribute on Uri returned False.
DEBUG: 2021-10-12 08:33:18.1236 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to param [Uri] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1246 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Invoke-RestMethod]
DEBUG: 2021-10-12 08:33:18.1250 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-10-12 08:33:18.1254 TypeConversion Information: 0 : Converting “” to “System.Collections.IDictionary”.
DEBUG: 2021-10-12 08:33:20.7574 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ! SET $response = ‘’.
DEBUG: 7+ >>>> $response | ConvertTo-Json} -PSHost
DEBUG: 2021-10-12 08:33:20.7696 ParameterBinderController Information: 0 : WriteLine Argument count: 0
DEBUG: 2021-10-12 08:33:20.7699 ParameterBinding Information: 0 : BIND NAMED cmd line args [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7703 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7707 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7711 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7713 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7716 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-10-12 08:33:20.7723 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7729 ParameterBinding Information: 0 : PIPELINE object TYPE = [System.String]
DEBUG: 2021-10-12 08:33:20.7732 ParameterBinding Information: 0 : RESTORING pipeline parameter’s original values
DEBUG: 2021-10-12 08:33:20.7738 ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-10-12 08:33:20.7747 ParameterBinderController Information: 0 : WriteLine Adding PipelineParameter name=InputObject; value=
DEBUG: 2021-10-12 08:33:20.7751 ParameterBinding Information: 0 : BIND arg to parameter [InputObject]
DEBUG: 2021-10-12 08:33:20.7752 ParameterBinding Information: 0 : BIND arg to param [InputObject] SUCCESSFUL
DEBUG: 2021-10-12 08:33:20.7758 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = True
DEBUG: 2021-10-12 08:33:20.7762 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7765 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = False
DEBUG: 2021-10-12 08:33:20.7769 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = False
DEBUG: 2021-10-12 08:33:20.7770 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = False
DEBUG: 2021-10-12 08:33:20.7774 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7779 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7783 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 7+ $response | ConvertTo-Json >>>> } -PSHost
“”

Can someone help me analyze the cause of the issue?

Thanks
Ivan

Hi Ivan, welcome to the forum :wave:

Please edit your post and use the preformatted text </> button to format your code and output.
It really helps us with readability and you have posted a lot for us to read :slightly_smiling_face:. Thanks.

Set-PSDebug -Trace 2
Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression {$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(“X-SFAPI-Account”, “philippinedemo”)
$headers.Add(“X-SFAPI-AppName”, “sfapidemo”)
$headers.Add(“X-SFAPI-RSAKey”, “MI//////////////////////////////////////////////////////////////////////////////////////6jCCA--------------------------------------++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++±-----------------------HDAdKYWthcnRhMRgwFgYDVQQK#########################################################1UEAwwCNjAxNjA0Bgkqhki%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5tdXN0aWthQGRhdGFvbi5jb20wMzEyMj*****************************************************************************************************************************************************************************gXsdzFdGD6wAQ9dg2Qzr2H0K/aNef4463DOET================================================================================================================3g0Ri)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))Gacx82y3Vko”)
$headers.Add(“Cookie”, “JSESSIONID=F503511AF058F7DC5EC44967845F614D; LASTSESSIONFROM=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LASTSESSIONTO=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LSESSIONID=DEVLC-184”)
$response = Invoke-RestMethod ‘https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd’ -Method ‘GET’ -Headers $headers -MaximumRedirection 0
$response | ConvertTo-Json} -PSHost
DEBUG: 1+ >>>> Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression {$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”

DEBUG: ! CALL function ‘’
DEBUG: 1+ Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression >>>> {$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”

DEBUG: ! CALL function ‘’
DEBUG: 1+ Trace-Command -Name ParameterBinderBase,ParameterBinderController,ParameterBinding,TypeConversion -Expression { >>>> $headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”

DEBUG: 2021-10-12 08:33:18.0261 ParameterBinderController Information: 0 : WriteLine Argument count: 1
DEBUG: 2021-10-12 08:33:18.0266 ParameterBinding Information: 0 : BIND NAMED cmd line args [New-Object]
DEBUG: 2021-10-12 08:33:18.0270 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [New-Object]
DEBUG: 2021-10-12 08:33:18.0272 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary[[String],[String]]] to parameter [TypeName]
DEBUG: 2021-10-12 08:33:18.0278 ParameterBinding Information: 0 : Executing VALIDATION metadata: [System.Management.Automation.ValidateTrustedDataAttribute]
DEBUG: 2021-10-12 08:33:18.0284 ParameterBinderBase Information: 0 : WriteLine Validation attribute on TypeName returned False.
DEBUG: 2021-10-12 08:33:18.0372 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary[[String],[String]]] to param [TypeName] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.0391 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = Net
DEBUG: 2021-10-12 08:33:18.0399 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = Net
DEBUG: 2021-10-12 08:33:18.0403 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [New-Object]
DEBUG: 2021-10-12 08:33:18.0421 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-10-12 08:33:18.0426 TypeConversion Information: 0 : Converting “System.Collections.Generic.Dictionary[[String],[String]]” to “System.Type”.
DEBUG: 2021-10-12 08:33:18.0434 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ! SET $headers = ‘System.Collections.Generic.Dictionary`2[System.String…’.
DEBUG: 2+ >>>> $headers.Add(“X-SFAPI-Account”, “philippinedemo”)

DEBUG: 3+ >>>> $headers.Add(“X-SFAPI-AppName”, “sfapidemo”)

DEBUG: 4+ >>>> $headers.Add(“X-SFAPI-RSAKey”, “MI//////////////////////////////////////////////////////////////////////////////////////6jCCA--------------------------------------++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++±-----------------------HDAdKYWthcnRhMRgwFgYDVQQK#########################################################1UEAwwCNjAxNjA0Bgkqhki%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5tdXN0aWthQGRhdGFvbi5jb20wMzEyMj*****************************************************************************************************************************************************************************gXsdzFdGD6wAQ9dg2Qzr2H0K/aNef4463DOET================================================================================================================3g0Ri)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))Gacx82y3Vko”)

DEBUG: 5+ >>>> $headers.Add(“Cookie”, “JSESSIONID=F503511AF058F7DC5EC44967845F614D; LASTSESSIONFROM=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LASTSESSIONTO=%7Bts%20%272021-10-12%2006%3A53%3A05%27%7D; LSESSIONID=DEVLC-184”)

DEBUG: 6+ >>>> $response = Invoke-RestMethod ‘https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd’ -Method ‘GET’ -Headers $headers -MaximumRedirection 0

DEBUG: 2021-10-12 08:33:18.0871 ParameterBinderController Information: 0 : WriteLine Argument count: 7
DEBUG: 2021-10-12 08:33:18.0926 ParameterBinding Information: 0 : BIND NAMED cmd line args [Invoke-RestMethod]
DEBUG: 2021-10-12 08:33:18.0946 ParameterBinding Information: 0 : BIND arg [GET] to parameter [Method]
DEBUG: 2021-10-12 08:33:18.0952 ParameterBinding Information: 0 : COERCE arg to [Microsoft.PowerShell.Commands.WebRequestMethod]
DEBUG: 2021-10-12 08:33:18.0970 ParameterBinding Information: 0 : Trying to convert argument value from System.String to Microsoft.PowerShell.Commands.WebRequestMethod
DEBUG: 2021-10-12 08:33:18.1020 ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-10-12 08:33:18.1030 TypeConversion Information: 0 : Converting “GET” to “Microsoft.PowerShell.Commands.WebRequestMethod”.
DEBUG: 2021-10-12 08:33:18.1034 TypeConversion Information: 0 : Calling case sensitive Enum.Parse
DEBUG: 2021-10-12 08:33:18.1038 TypeConversion Information: 0 : Enum.Parse Exception: “Requested value ‘GET’ was not found.”.
DEBUG: 2021-10-12 08:33:18.1042 TypeConversion Information: 0 : Calling case insensitive Enum.Parse
DEBUG: 2021-10-12 08:33:18.1046 ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [Get]
DEBUG: 2021-10-12 08:33:18.1050 ParameterBinding Information: 0 : BIND arg [Get] to param [Method] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1052 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary2[System.String,System.String]] to parameter [Headers] DEBUG: 2021-10-12 08:33:18.1058 ParameterBinding Information: 0 : COERCE arg to [System.Collections.IDictionary] DEBUG: 2021-10-12 08:33:18.1063 ParameterBinding Information: 0 : Trying to convert argument value from System.Management.Automation.PSObject to System.Collections.IDictionary DEBUG: 2021-10-12 08:33:18.1069 ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo DEBUG: 2021-10-12 08:33:18.1079 TypeConversion Information: 0 : Converting "System.Collections.Generic.Dictionary2[System.String,System.String]" to “System.Collections.IDictionary”.
DEBUG: 2021-10-12 08:33:18.1081 TypeConversion Information: 0 : Result type is assignable from value to convert’s type
DEBUG: 2021-10-12 08:33:18.1085 ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [System.Collections.Generic.Dictionary2[System.String,System.String]] DEBUG: 2021-10-12 08:33:18.1091 ParameterBinding Information: 0 : BIND arg [System.Collections.Generic.Dictionary2[System.String,System.String]] to param [Headers] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1095 ParameterBinding Information: 0 : BIND arg [0] to parameter [MaximumRedirection]
DEBUG: 2021-10-12 08:33:18.1098 ParameterBinding Information: 0 : COERCE arg to [System.Int32]
DEBUG: 2021-10-12 08:33:18.1102 ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-10-12 08:33:18.1105 ParameterBinding Information: 0 : Executing VALIDATION metadata: [System.Management.Automation.ValidateRangeAttribute]
DEBUG: 2021-10-12 08:33:18.1171 ParameterBinderBase Information: 0 : WriteLine Validation attribute on MaximumRedirection returned False.
DEBUG: 2021-10-12 08:33:18.1182 ParameterBinding Information: 0 : BIND arg [0] to param [MaximumRedirection] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1186 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Invoke-RestMethod]
DEBUG: 2021-10-12 08:33:18.1190 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to parameter [Uri]
DEBUG: 2021-10-12 08:33:18.1193 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to param [Uri] SKIPPED
DEBUG: 2021-10-12 08:33:18.1197 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to parameter [Uri]
DEBUG: 2021-10-12 08:33:18.1200 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to param [Uri] SKIPPED
DEBUG: 2021-10-12 08:33:18.1203 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to parameter [Uri]
DEBUG: 2021-10-12 08:33:18.1207 ParameterBinding Information: 0 : COERCE arg to [System.Uri]
DEBUG: 2021-10-12 08:33:18.1209 ParameterBinding Information: 0 : Trying to convert argument value from System.String to System.Uri
DEBUG: 2021-10-12 08:33:18.1214 ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-10-12 08:33:18.1218 TypeConversion Information: 0 : Converting “https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd” to “System.Uri”.
DEBUG: 2021-10-12 08:33:18.1222 ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd]
DEBUG: 2021-10-12 08:33:18.1227 ParameterBinding Information: 0 : Executing VALIDATION metadata: [System.Management.Automation.ValidateNotNullOrEmptyAttribute]
DEBUG: 2021-10-12 08:33:18.1232 ParameterBinderBase Information: 0 : WriteLine Validation attribute on Uri returned False.
DEBUG: 2021-10-12 08:33:18.1236 ParameterBinding Information: 0 : BIND arg [https(:)//sfcola1[dot]dataon[dot]com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd] to param [Uri] SUCCESSFUL
DEBUG: 2021-10-12 08:33:18.1246 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Invoke-RestMethod]
DEBUG: 2021-10-12 08:33:18.1250 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-10-12 08:33:18.1254 TypeConversion Information: 0 : Converting “” to “System.Collections.IDictionary”.
DEBUG: 2021-10-12 08:33:20.7574 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: ! SET $response = ‘’.
DEBUG: 7+ >>>> $response | ConvertTo-Json} -PSHost
DEBUG: 2021-10-12 08:33:20.7696 ParameterBinderController Information: 0 : WriteLine Argument count: 0
DEBUG: 2021-10-12 08:33:20.7699 ParameterBinding Information: 0 : BIND NAMED cmd line args [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7703 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7707 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7711 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7713 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7716 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-10-12 08:33:20.7723 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7729 ParameterBinding Information: 0 : PIPELINE object TYPE = [System.String]
DEBUG: 2021-10-12 08:33:20.7732 ParameterBinding Information: 0 : RESTORING pipeline parameter’s original values
DEBUG: 2021-10-12 08:33:20.7738 ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-10-12 08:33:20.7747 ParameterBinderController Information: 0 : WriteLine Adding PipelineParameter name=InputObject; value=
DEBUG: 2021-10-12 08:33:20.7751 ParameterBinding Information: 0 : BIND arg  to parameter [InputObject]
DEBUG: 2021-10-12 08:33:20.7752 ParameterBinding Information: 0 : BIND arg  to param [InputObject] SUCCESSFUL
DEBUG: 2021-10-12 08:33:20.7758 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = True
DEBUG: 2021-10-12 08:33:20.7762 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7765 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = False
DEBUG: 2021-10-12 08:33:20.7769 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = False
DEBUG: 2021-10-12 08:33:20.7770 ParameterBinderController Information: 0 : WriteLine aParameterWasBound = False
DEBUG: 2021-10-12 08:33:20.7774 ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-10-12 08:33:20.7779 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [ConvertTo-Json]
DEBUG: 2021-10-12 08:33:20.7783 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 7+ $response | ConvertTo-Json >>>> } -PSHost

Please let me know if what I did is correct or not.

It is possible to edit the original post rather than create new ones but don’t worry, what you’ve done is fine :+1:, it’s much more readable. I think you’ve copied it from your original post though as the curly quotes are still present.

If the API key and Account should not be public, you should edit your posts to remove that information.

Regarding your actual problem, it’s a bit difficult for anyone to comment without access to the API in question or, perhaps, a link to some documentation.

Have you tried with Invoke-WebRequest to see if you get any kind of response?

Yes I still get no output.

Invoke-WebRequest 'https://sfcola1.dataon.com/sfapi/index.cfm?endpoint=/philippinedemo_FULL_SDP_test_abcd' -Method 'GET' -Headers $headers -MaximumRedirection 0


StatusCode        : 200
StatusDescription :
Content           :
RawContent        : HTTP/1.1 200
                    x-sfapi-reloaded: true
                    x-time-to-reload: 1022
                    x-foo-globalheader: sfapi,sfapi
                    allow: GET
                    x-time-in-parse: 2
                    x-time-in-ontaffyrequest: 1
                    x-time-in-resource: 349
                    x-time-in-cache-ch...
Forms             : {}
Headers           : {[x-sfapi-reloaded, true], [x-time-to-reload, 1022], [x-foo-globalheader, sfapi,sfapi], [allow, GET]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 0