Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

HTTP requests to On-Premise Web API

$
0
0

Hello,

I've seen a number of questions posted about how to execute Web API requests via HTTP external to the CRM, but I still am very unclear how to do this. It's rather frustrating that I can simply navigate to the ".../api/data/v8.0/" end point in my browser, but can't seem to access this via any other method. In PowerShell, I've tried the following code:

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", 'application/json')
$headers.Add("OData-MaxVersion", '4.0')
$headers.Add("OData-Version", '4.0')

Invoke-WebRequest -Uri 'crmtest.regent.edu/.../v8.0' -Headers $headers -Credential Get-Credential

But I get this error:

Invoke-WebRequest : The underlying connection was closed: An unexpected error
occurred on a send.
At line:6 char:1
+ Invoke-WebRequest -Uri'crmtest.regent.edu/.../v8.0 ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpW
   ebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell
   .Commands.InvokeWebRequestCommand


I've tried the Invoke-RestMethod as well. Similar requests in JavaScript don't seem to yield requests either.

What am I doing wrong?

Many thanks,

Daniel Hines

Regent University

Christian Leadership to Change the World


Viewing all articles
Browse latest Browse all 79901

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>