Why am I getting a 404 error with an http object in ColdFusion 11 when the URL exists? - cfml

I have an HTTP object I am using in my application like so...
httpService = new http();
httpService.setURL("http://#application.thishost#/cfc/comp.cfc?method=methodName&oData=#url.oData#");
httpService.setPort(80);
httpService.setMethod("get");
httpService.setResolveURL("no");
httpService.setThrowOnError("yes");
local.response = httpService.send().getPrefix().filecontent;
For some reason this is throwing a 404 error and I can't figure out why. I have trapped the error and spit out httpService.getURL() and then pasted the URL into my browser and the page loads and executes without a problem. Any help appreciated.

Related

GET request to opensea API giving 403 error

I'm trying to retrieve the asset info from a specific collection using the asset endpoint.
Example:
https://api.opensea.io/api/v1/asset/0x1a92f7381b9f03921564a437210bb9396471050c/2000/?format=json
Now, if you open that on your browser, it works flawlessly, but on your app or postman it just gives a 403 error by CloudFlare.
This is not a 401 error and we shouldn't need an API key for this.
So what is going on and how do I fix this? Any ideas?

Recieving 404 error when running get request to Amadeus low-fare-search API

Hi I am very new to Angular and programming in general and I have been trying to query the Amadeus low-fare-search with Angular HTTPClient and failing, I have been looking around for answers, but havent found anything specific to this, I have found some answers related to the specific problem of "unable to identify proxy".
And according to some the reason for this is that the URL is incorrect.
But this is the URL on Amadeus page
Resource URL
This is the code i am trying to run :
search(){
return this.http.get('http://api.sandbox.amadeus.com/v1.2/flights/low-fare-search?origin=IST&destination=BOS&departure_date=2018-10-15&return_date=2018-10-21&number_of_results=3&apikey=my API key')
.subscribe((data) =>{
console.log(data)},
(err) => {console.log(err)});
Here is the error message
errorcode: "messaging.adaptors.http.flow.ApplicationNotFound"
faultstring:"Unable to identify proxy for host: default and url:
/v1.2/flights/low-fare-search"
Can someone explain to me in simple terms what could be causing this error?
In your example, you are using http instead of https
I tested your example and it works for me:
https://api.sandbox.amadeus.com/v1.2/flights/low-fare-search?origin=IST&destination=BOS&departure_date=2018-10-15&return_date=2018-10-21&number_of_results=3&apikey={your_api_key}

Force 404 error for Coldfusion REST API

I've been developing an API for a ColdFusion app using their built in RESTful webservice. I'm running into a problem though with invalid url pathways. Normally if I hit an invalid directory such as https://myapp.com/invalid/path/ Coldfusion will throw a 404 but if I hit an invalid url under "/rest" such as https://myapp.com/rest/invalid/path/ then I get a blank 200 response and in my error logs:
"Application could not be found. - Application could not be found.
null The error occurred on line -1."
Instead of this behavior I want my application to throw a 404 when an invalid pathway is being hit. Any ideas on how to accomplish this?

Can't access api.quickblox.com/session.xml

When I try to access api.quickblox.com/session.xml to create a session, I get a 404 error.
I tried to access it in both browser and c#.
In the browser I get:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
In C# I get
System.WebException: (404) Not Found.
You have to use POST request (not GET) to access to this API
Please read here http://quickblox.com/developers/Authentication_and_Authorization#Requests_and_Responses

MalformedURLException in application tests

I'm working on application tests and have found an issue.
My app. has an authenticate(email, password) action inside the
Security controller and when invoked, from the login page, with a
valid e-mail and invalid password it sends me back to the login page
with an error message, located in the flash scope.
The app. test code follows :
Response response =
GET("/security/authenticate?email=validUser&password=invalid", true);
String pattern = "invalid password";
assertContentMatch(pattern, response);
When this code is run throws the next exception :
A java.lang.RuntimeException has been caught,
java.net.MalformedURLException: no protocol: /login
Did some research and found that :
the exception is thrown when a new URL object creation is attempted,
to be able for redirection, using an invalid URL. In this case no
protocol is present
looking at app. test in samples apps. GET is used without
redirection, meaning that after GET only the http code is verified but
no attempt to follow the redirection
Has anyone had this same issue also ?
Any open bug to look for info or add my 2 cents ?
Here you can find a description of the problem as well as code snippet to work around the issue:
https://play.lighthouseapp.com/projects/57987/tickets/1553-functionaltestget-with-redirect-crashes