When trying to open Swagger-UI getting only a json Response - asp.net-web-api2

I am getting the following response when requesting for Swagger doc in a Web API project,even the same response getting from Azure.
Can any one help me to get the Swagger UI.

Perhaps try to request the Swagger-UI through a different url, eg.../swagger/index.html.

I am not working with .NET here and I have no Idea about your setup, but did you (for example) copied swagger-ui resources to your webdir?
It looks like you are calling swagger interface directly and not swagger-ui (which is something different).
https://swagger.io/swagger-ui/
from Swagger-Ui Documentation:
Step 1: Go to the GitHub repository of the Swagger UI project
Step 2: Clone or download the zip file of the repository
https://github.com/swagger-api/swagger-ui
Usage
Step 1: Go to the folder containing the Swagger UI project in your local machine
Step 2: Open the dist folder
Step 3: Run the dist/index.html file on a browser or place the dist folder inside your server.
Step 4: The Swagger UI will now be live in the browser, with the default rendering of the Swagger Petstore. The JSON specification of the Swagger Petstore can be found here - http://petstore.swagger.io/v2/swagger.json
Note: Please remember that to load a specification and execute the UI’s try out requests, you would need to have enabled CORS (read below)
Step 5: You can mention the YAML or JSON path of any existing specification hosted on a server in the field on the top navigation bar.

The correct URL for the UI would be https://localhost:44390/swagger/ui/index

Check if swagger is configured to use any custom route or prefix. In this case the UI URL would be url:port/route-prefix/index.html. Route prefix empty = url:port/index.html.

Related

how to automate principal component analysis and show on a web page, is it possible?

I have result of Dimension reduction using principal component method and I want to show that result on web portal by just making a web page where user select the variable and do analysis. I have ipynb file which is juypter notebook file. any solutions for this ??
Now I got the solution of this---
First convert ipnyb file to py file and read that file in python environment
and run the file.
Output comes up
get http response by using http web client api.
Now Read the output data in any language you are comfort with. as I Read this
using asp .net and python engine and made web portal using this file.

swagger API documentation with my own yaml file

I have my API documented with Swagger. For developer convenience I would like to provide the swagger GUI on my website as well. However, my provider has not installed the php yaml extension. It implies that I can't use the GUI on my own website.
So, I would like to use a third party GUI. I know that I can use https://petstore.swagger.io/ and enter the link to my yaml file in the text box. This is also not really user friendly. I prefer to open the GUI and specify the yaml when calling the url. For the user the GUI opens with my API definition.
Any thoughts?
If for some reason you cannot host Swagger UI youself, here are some alternatives you can try:
Use SwaggerHub to host your API definition and docs.
Disclosure: I work for the company that makes SwaggerHub.
Use GitLab to host your OpenAPI YAML/JSON file. GitLab uses Swagger UI to render OpenAPI files. Example:
https://gitlab.com/gofus/gofus-api/blob/dev/swagger.yaml
Use https://petstore.swagger.io with the url query parameter to automatically load your API definition:
https://petstore.swagger.io?url=https://yoursite.com/api.yaml
For this to work, the server where your OpenAPI file is hosted must use HTTPS and support CORS.

DownLoad VichBundle file Api Platform

I'm using API platform with VichBundle to store file on the back side and React Native on the Front side.
I've followed the documentation of API platform and the upload part is working well, but I don't know how to download the document.
When I make a GET request I have the entity with the url of the file but I can't do a GET request with this url because there is no route to this file.
Can somebody give me an exemple of how to download file with api platform and Vichbundle.
Thanks
If you are following Api Platfom's documentation your files should be uploaded to your project's ./app/public/media/ folder and available making an HTTP GET request to http(s)://<yourdomain>/public/media/<filename>.<extension>. Just open the URL in your browser.
To get the exact url query yout API for me mediaObject information (for example, /api/media_objects/{id}) and check the contentUrl property.

SpringBoot jar project + swaggerUI + chef + dynamic variables

I have a SpringBoot application that uses Swagger for the API doc and Swagger-UI for rendering it.
Before using the any of the endpoints from swagger-ui I need to retrieve a bearer token and for this a clientID and an authorize endpoint are used
I have 2 different environment where both the clientID and the authorize endpoint are different.
I'm using chef to handle the deployment of my app (which is a JAR started as java -jar myapi.jar) which builds a different application.properties for each environment but because the clientID and auth url are in the swagger-ui's index.html and that thee files are INSIDE the jar I don't know how to use chef to replace these values at deploy time.
Is there a way I can passed these values somehow? Or the only solution is to not have a JAR but an exploded jar ?
TLDR: I want to be able replace values in the index.html depending on the environement
I;m not aware of anything in springboot/swagger that let you pass values to the static files (aka ${clientId} from your index.html)
What you could do though is having chef template (a simple json file can be enough) containing
{
"clientID":..
"authUrl: ..
}
That you make chef write in the same directory where your index.html is. And in your index.html write some javascript to load that file.

MVC 4: How to add some specific URL directly to BundleConfig

How to bind a virtual url (other than "jquery.js") in a BundleConfig.
example : "www.xyz/xyz.js"
I can't keep one JS file in my local folder, I have to access it directly from web.
I tried this link, but it couldn't help me. Using CDN in MVC script bundle. What am I missing?
Thanks.
Himanshu Pareek.