Reputation: 105
I am trying to connect to the Sabre API using the following code:
Dim u As String = "https://developer.sabre.com/io-docs/call-api"
' Create the web request
request2 = DirectCast(WebRequest.Create(u), HttpWebRequest)
' Get response
response2 = DirectCast(request2.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader2 = New StreamReader(response2.GetResponseStream())
' Console application output
' MsgBox(reader.ReadToEnd())
Response.Write(reader.ReadToEnd())
However I am getting the following error:
Server Error in '/' Application.
The remote server returned an error: (400) Bad Request.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request.
Source Error:
Line 49:
Line 50: ' Get response
Line 51: response2 = DirectCast(request2.GetResponse(), HttpWebResponse)
Line 52:
Line 53: ' Get the response stream into a reader
Upvotes: 1
Views: 783
Reputation: 1429
I recommend you to go through the REST basics: https://developer.sabre.com/docs/rest_basics
There you have the different environment URLs, how to create sessions, and how to start consuming the REST APIs, same works for SOAP APIs.
The process on how to actually call each service will depend on the language, since you seem to be using VB.NET here you have 2 guides I found.
Using the REST Services with .NET (Microsoft.com)
https://msdn.microsoft.com/en-us/library/jj819168.aspx
Consuming a Json WebService from a C# or VB Application (Codeproject.com)
https://www.codeproject.com/Articles/233698/Consuming-a-Json-WebService-from-a-Csharp-or-VB-Ap
Upvotes: 2
Reputation: 517
You are not referencing the correct Sabre API endpoints. I would recommend looking at the .Net Sabre API Code Sample for reference information.
https://github.com/SabreDevStudio/SACS-DotNet
Upvotes: 1