How to resolve 500 Message:An error has occurred while Accessing API from Azure? - api

I am working with Azure Mobile Services API, my API on the local host running well. I have checked with the help of Swagger UI. but when I publish my API to azure then after that by accessing the API with Swagger I got this error.
500 : {"Message":"An error has occurred."} http://xxxxxxxxxxx.azurewebsites.net/swagger/docs/v1
Now if I type this route http://xxxxxxxxxxx.azurewebsites.net/tables/doctor?ZUMO-API-VERSION=2.0.0
to any table then I got the result,
why not with swagger?
help me to get on the right path.

Please make sure your XML file is available on the same location as you have defined in the swagger UI properties on Azure.
I would highly recommend to generate your swagger xml file
Steps :
Right click on webapi project
Properties => build tab
Output section - in different folder other than bin.
For example : App_Start\\{ProjectName}.xml

Related

Get source data from API

My team is trying to configure an Informatica job that pulls data from the SurveyCTO API. According to the documentation, the output is in CSV or JSON format.
I've seen this video and it looks like it's using ODBC to configure a JSON driver.
Is there a more direct / native way to connect to the API in Informatica? How can I setup the Informatica job to pull the data directly from the API?
Update
We were able to find the API Connector in our cloud PowerCenter and are trying to configure the Swagger file. We successfully created a Swagger file for a public API, but were unable to do so for our SurveyCTO API. We get an invalid URL error:
The SurveyCTO API URL is valid -- we tested it and it returned results, outside of Informatica.
Any ideas on what the issue could be?
References
Generating a Swagger file
HOW TO: Generate Swagger file in IICS

Azure File Storage the server responded with a status of 400 (Condition headers are not supported.)

I have some png files stored in Azure file Storage, and I'm retrieving and displaying it from my MVC web project to the browser. But sometimes I get the below error message from browser console.
Failed to load resource: the server responded with a status of 400
(Condition headers are not supported.)
If I refresh the page again, the error message disappears automatically. But it doesn't solve my problem as I run my MVC project again, the same error comes back. How to solve it?
It's acutally a common issue on Azure Storage, which be listed in the offical reference Common REST API Error Codes as the figure below.
It means that Get File REST API does not support those request headers which not be listed in the Request Headers.
There is a similar SO thread Azure File Storage Error: Condition Headers Are Not Supported, which got the same issue with yours. It seems to show up different behavior in different browses when you get a file from Azure File Storage.
I could not reproduce this issus by a file url with SAS token, but I really recommend that you need to store these static files like images on Azure Blob Storage, as I known and as Azure best practice, to show an image by its url with sas token or a public container.

Web Api documentation with swashbuckle

We are currently trying to start writing WebApi services for our products switching from traditional WCF SOAP based services. The challenge we have got is how to provide the api documentation. I came across the SwaggerUi/swash buckle.
One limitation we have is we do not want to host the WebApi services in IIS but in a Windows Service. I am new to Web Api so I might be doing things the wrong way.
So for testing, I am hosting the web api in a console application. I can use the HttpClient to invoke the Get method on the Web Api but I can't access the same if I type the url in a web browser (is this normal for self hosted web api?).
So I installed the Swashbuckle.core nuget package and included the following code in the Startup class (Owin selfhosted).
var config = new HttpConfiguration();
config
.EnableSwagger(c =>
{
c.IncludeXmlComments(GetXmlCommentsPath());
c.SingleApiVersion("v1", "WebApi");
c.ResolveConflictingActions(x => x.First());
})
.EnableSwaggerUi();
private static string GetXmlCommentsPath()
{
var path = $#"{AppDomain.CurrentDomain.BaseDirectory}\WebApiHost.XML";
return path;
}
When I browse to the following location
http://localhost:5000/swagger/ui/index
I get "page cannot be displayed" in IE. Similar for chrome.
Is there anything special that needs to be done when hosting a WebApi in a console/windows service application to get the documentation automatically?
(I have enabled Xml documentation for the project)
I have now attached a test project. Please follow the link below:
Test project
Regards,
Nas
Your problem is not with Swashbuckle, which is configured correctly. Instead it is with the fact that your OWin web app has closed by the time the browser navigates to the swagger URI. Your using statement means that the web app is shut down at the end of it - well before Chrome has opened and navigated to the swagger path. You need to ensure the web app is still running - then your path will be valid (although in your source code you have different ports 9000 and 5000 in your url variables).

xsodata service without authentication

I am trying to create some xsodata services using SAP Hana XS Engine. I have created a .xsaccess file at global folder level which has the following content:
{
"exposed": true,
"authentication" : null
}
I have a services folder inside my parent folder where I have created a test service. The content of the service is
service namespace "example.services" {
"TESTUSER1"."testdb" as "testdb";
}
But when I hit this url: /example/services/example.xsodata/testdb I get a 403 error. To verify if my .xsaccess if working fine, I created a dummy html file in the same folder as example.xsodata service. If I hit that link, it works fine and does not ask me any authentication.
To extend it further, I added .xsaccess file in services folder and added the same content as that mentioned above. It still gives 403 error to my example.xsodata service. To try this even further, I made the services/.xsaccess to have this content
{
"exposed": true,
"authentication" : [{"method":"Basic"}]
}
This prompted me for username/password and when i entered the values, it showed me the correct data as I expected.
I am utterly confused here because I want to make the services without authentication (for which i set authentication as null) and it is not working.
Please help me understand what am I missing here. Any help is really appreciable.
Answering my own question. Please follow this link from sap community network to get answer: http://scn.sap.com/thread/3496997

How does one publish a map to the web?

Just starting out with ArcGIS server at work, I've had no prior experience but I been given the responsibility to display our map on the web.
I have a ArcGIS server running on a server and I am using ArcMap 10 on my desktop. I created a Folder in the server where I saved the map document. I can add a new service using this document and I'm given a url when I do so. But when I go to that URL I get this error:
Server Error in '/ArcGIS/Services' Application.
Runtime Error
And, when going to the same url from the server I get:
Server Error in '/ArcGIS/Services' Application.
No Content
Do you try to open servername/ArcGIS/services via browser? This url is for SOAP requests, e.g. you can add '?wsdl' to it ang get SOAP service description. To use it with browser you'll need ArcGIS Server REST API, i.e. use 'servername/ArcGIS/rest/services' URL.