We expose our API service at api.sandbox.amadeus.com.
Different sub-URLs of this domain go to different API proxies,but messages to the root service, or undefined proxies at https://api.sandbox.amadeus.com/ get an ugly error 400 with the following message
{"fault":{"faultstring":"Unable to identify proxy for host: default and url: \/","detail":{"errorcode":"messaging.adaptors.http.configuration.ApplicationNotFound"}}}
I would prefer to offer a more user friendly 404 message to the lost developer trying to find our API services. How can I customize this message to something that will point them in the right direction?
Solved! Go to Solution.
Hi @tpearson
Wrote a proxy just now with "/" as the base path. Handles both your requirements (root and undefined proxy end points). For now I just made up a response
{ "message":"Not Found", "helpUrl":"https://en.wikipedia.org/wiki/HTTP_404", "type":"404" }
You can update it to something more appropriate.
Attached the bundle as well.catchall-rev1-2016-05-25.zip
Hi Sai,
This put me on the right path. However, I'm surprised there's no either way to set this default, or that it isn't bundled within Edge - since I guess we are not the only users that fail to do this
Finally I created a simple proxy with just this step named
NotFound.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RaiseFault async="false" continueOnError="false" enabled="true" name="Not-Found"> <DisplayName>Not-Found</DisplayName> <FaultResponse> <Set> <Headers> <Header name="Access-Control-Allow-Origin">*</Header> <Header name="Access-Control-Allow-Headers">origin, x-requested-with, accept</Header> <Header name="Access-Control-Max-Age">3628800</Header> <Header name="Access-Control-Allow-Methods">GET, PUT, POST, DELETE</Header> </Headers> <Payload contentType="application/json">\{ "status": 404, "message": "Not found. There is no service at this address", "more_info": "For full documentation on the available endpoints, see our API catalog at https://sandbox.amadeus.com" } </Payload> <StatusCode>404</StatusCode> <ReasonPhrase>Not Found</ReasonPhrase> </Set> </FaultResponse> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </RaiseFault>
and this default.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ProxyEndpoint name="default"> <PreFlow name="PreFlow"> <Request> <Step> <Name>Not-Found</Name> </Step> </Request> </PreFlow> <HTTPProxyConnection> <BasePath>/</BasePath> <Properties/> <VirtualHost>https_vhost</VirtualHost> <VirtualHost>secure</VirtualHost> <VirtualHost>default</VirtualHost> </HTTPProxyConnection> <RouteRule name="noroute"/> </ProxyEndpoint>
Hello @Sai Saran Vaidyanathan,
Thanks for the good reply, but this approach is working when we are having one and only the default proxy with the base path "/". Now in case i want the other proxies having their corresponding base paths, in that case they are never executed. The call to Apigee proxy always goes through the default proxy in which the base path is set to "/" e.g. the only proxy you created in this example.
@Harsh Sharma , Answers are strictly for answers. Use comments for discussion / follow up.
Hello Everyone,
I got the solution for this problem, we can use the following property tag,
<alwaysEnforce>false</alwaysEnforce>
By using this we just remove the enforcement of Apigee's service call to the default endpoint.
In the above image, please have a look what i am going to do. Created another endpoint as hello. After the execution, Apigee always gives the preference to the default endpoint, not to the other endpoints.