Getting 404 error calling Status

Getting 404 error calling Status

Postby mskoglund » Sun Aug 06, 2017 5:03 am

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("https://json.schedulesdirect.org/20141201/status");
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
mskoglund
 
Posts: 2
Joined: Sat Aug 05, 2017 11:16 am

Re: Getting 404 error calling Status

Postby jcole998 » Wed Sep 13, 2017 6:54 am

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 https://json.schedulesdirect.org/20141201/token -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.

Thanks.

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


Return to Developer

Who is online

Users browsing this forum: No registered users and 2 guests