Getting 404 error calling Status

Post Reply
Posts: 2
Joined: Sat Aug 05, 2017 11:16 am

Getting 404 error calling Status

Post by mskoglund »

Using C# and .NET I am getting a 404 return code from the "status" interface using the following code:

Code: Select all

var httpWebRequest = (HttpWebRequest)WebRequest.Create("");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
httpWebRequest.UserAgent = SDData.userAgent;
httpWebRequest.Headers.Add("token", SDData.token.token);

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
I have successfully called "token" and I think I have added the value to the Header.

I am experienced in .NET but this is my first time calling a JSON interface.

Any help would be appreciated, thanks.
Mark Skoglund

Posts: 1
Joined: Sat Jun 25, 2016 11:47 am

Re: Getting 404 error calling Status

Post by jcole998 »

Hello. I see that no one replied to your question. May I guess that you solved your problem? If so, I could use your help.

I am trying to use Windows Powershell to access SD schedules but without success. I am new to Powershell but the language and syntax closely resembles C#. Could you send a C# code snippet that gets the token? I've had no success getting the call to work. The website return code is always "400 Bad input."

Here's what I've tried:

$sdUID = 'abcdef'
$sdPW = Get-StringHash -String "123456" -HashName "SHA1"
$sdPW = $sdPW.ToLower()
$jhsdLogin = @{"username"= $sdUID; "password"= $sdPW} | ConvertTo-Json
$sdUAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer
$sdToken = Invoke-WebRequest -Uri -UseBasicParsing -Method Post -Body $jhsdLogin -UserAgent $sdUAgent -ContentType "application/json;charset=UTF-8" -Debug

Hope you can help or maybe lead me to somewhere more appropriate.



Post Reply