Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio unable to add swagger metadata file in my rest api client

I am new to mobile development. As i am familiar with c# .net so i am using xamarin plugin for visual studio. I have created a sample app in which i have used SQLite, created a DB and then performed CRUD operations. At this point all things are working good. But i already have a local DB and i want to use it. For this i have made an offline Azure api using swagger and on Release i have saved the files locally by using File System in release option in VS. Now i want to add my app as rest api client and want to use my local DB. But when i try to add as rest api client and then i select select an existing swagger file so while browsing i can't find any file. For reference please see the images bellow

enter image description here

So when i click browse and goto the location where i have saved my files for swagger i get nothing as shown in bellow image

enter image description here

Also it's finding the .json extension file which is not present in my publish api.

I don't know why it's happening, also as already told above i am new to mobile development i am not sure what to do. Kindly see the bellow image of my swagger UI

enter image description here

Any help would be highly appreciated

like image 876
Moeez Avatar asked Oct 18 '22 22:10

Moeez


1 Answers

The URL you listed is for the user-friendly reference docs for your API; there should be a corresponding URL for the JSON definition endpoint for your API. Use this instead in the Add Rest API Client dialog in the "Swagger URL" option.

The other option is to use this peer URL to download the JSON description of your REST API into a local .json file and reference that when generating your client access classes.

For an example of these two endpoints, see https://msdn.microsoft.com/en-us/library/mt788315.aspx#Anchor_1.

like image 84
Milar Avatar answered Oct 20 '22 22:10

Milar