1
When trying to make an HTTP GET call, the service returns an error 500 because querystring should use the + encoded symbol instead of spaces. Ex.: LOS+ANGELES = LOS%ANGELES
autocomplete(term: string){
var url = this.serviceUrl + 'autocomplete?query=' + term + '&limit=5';
console.log(url);
return this.http
.get(url, { headers: this.headers })
.map((res: Response) => res.json());
}
Error returned when trying to make a call by passing some text with space, e.g.: los Angeles.
status
:
500
statusText
:
"Internal Server Error"
type
:
2
url
:
"https://api.test.sabre.com/v1/lists/utilities/geoservices/autocomplete?query=los%20a&limit=5"
_body
:
"{"status":"Unknown","reportingSystem":"RAF","timeStamp":"2017-09-21T12:03:40+00:00","type":"Application","errorCode":"ERR.RAF.APPLICATION","instance":"raf-darhlc006-9080","message":"Illegal character in query at index 75
I recommend you use the Postman program to test your requests. If it works on it, you will know how a request is made this way. Looking at it this way I could not find any error, just testing even to know. Good luck there
– Samuel Rizzon
I only use the Postman for testing!
– mcamara
what happens is if I pass a value in the url with space, eg:LOS ANGELES, the string is converted to LOS%20ANGELES and the service returns an error 500, because it does not accept this type of Find.
– mcamara
And it’s working this way that you’re making the requisition there at Postman?
– Samuel Rizzon
Yes, look at that crazy, I think I understood better, when I make the request I need to pass in place of the spaces the symbol + porem with ENCODE understands?
– mcamara
Yes, I get it. Google puts this + symbol a lot in the searches.
– Samuel Rizzon
What type of Content-Type you are using in the request?
– Renato Diniz
@Renatodiniz application/json
– mcamara