API Management Service can't find API definition - azure-api-management

I'm trying to create a new API Management Service (AMS) on Azure. I'm facing an issue I have never had before. I have my OpenAPI file in a public URL. If I paste this URL to create a new APIs in AMS, I always receive an error
Unable to download specified file. Please ensure the URL is valid and the file is publicly accessible.
Then, I tried to download this OpenAPI definition from the Azure Console and it can reach the file and download it. This issue happens from yesterday before I could use the same OpenAPI file without problem.
Also, I checked the configuration of the Virtual Machine where the APIs are hosted. It seems correct and I can reach the file from a browser.

The error of unable to download ... perhaps comes from the ip address url, because when I fill the field with an azure storage blob url, I received no error.
And I saved your request response into a json file locally and upload it to apim, I got the error of unable to parse specified file, I found it resulted from missing servers.url.
I think you can try to add api instance by uploading json file from localhost.

After a long call with Microsoft support, I found the issue. In the Network Security Groups, I added a new Inbound Security Rule.
First, Source. I saw there is an option for Service Tag. If I select Service Tag, the following dropdown change the label in Source service tag. From this dropdown, you there is an option for ApiManagement.
Wrong choice. You have to allow select IP from the dropdown list and type the IP of the API Management Service.
I have create a post on my blog to explain step by step what you have to do. Hopefully, it could be useful.

Related

Can download files (without file name or extension), but unable to see them?

I'm using the Google Drive API to generate a downloadable link for a file that looks like this:
https://www.googleapis.com/drive/v3/files/{file_id}?access_token={access_token}&alt=media
The problem is files are being downloaded without name and without extension.
If I add the extension manually after the file downloads it still works, but it's bad to tell my users they have to do that every time, and the user would have to know which extension the file actually has.
If I call https://www.googleapis.com/drive/v3/files/?access_token={access_token}
I can't see the files I've uploaded... I think it could be a problem related to having access to the files' metadata, but I did authorize the auth.files.metadata scope.
I generate the access token using the refresh token and obtained the refresh token from the Oauth Playground... I'm confident I used the proper credentials for my application, but I could triple-check if someone suggests this could be the problem.
What can I do to debug this?

hosting a JSON file for a 3rd party app/service to use

We currently use Jive Cloud N which can use the Rest API and allows the use of Custom Apps. Our UI devs have created an app which uses a JS GET to pull data from a JSON file for our "Birthdays and Anniversaries" tile.
At the moment, the JSON file is hosted on our UI dev's Google Cloud Apps account, but we wish to host it internally so we don't have to keep contacting them for changes.
I uploaded the file to our OneDrive for Business storage and created a public URL with full read permissions but the Jive platform is throwing an error trying to load the custom app.
The error is that the file
has been blocked by CORS policy: No "Access-Control-Allow-Origin"
header is present
Our dev said that to get it working on his Google Cloud App storage, he had to specify the allow-control-allow-origin field in the server's server app.yaml file. I don't know what this is and if there is an equivalent for ODfB/SharePoint.
To get to my question: How can I host this JSON file on ODfB or even somewhere on our Azure tenancy so that it can be used? Or am I better off trying to setup a Google Cloud App storage location and replicate our dev's setup? FYI - I'd prefer the former because we're using M$ for a number of cloud hosted services already.
Thanks in advance
To get to my question: How can I host this JSON file on ODfB or even somewhere on our Azure tenancy so that it can be used?
FYI - I'd prefer the former because we're using M$ for a number of cloud hosted services already.
Per my understanding, you could leverage Azure Blob Storage to store your JSON file, and you could use Microsoft Azure Storage Explorer to easily manage/share your files.
Moreover, You could manage anonymous read access to your containers and blobs, refer to this tutorial for more details. Also, you could leverage SAS to grant limited access to your storage account for other clients, you could follow this tutorial for getting started with SAS.
For a simple way, you could create your storage account and leverage Microsoft Azure Storage Explorer to manage/share your file as follows:
For cross domain accessing, you need to configure CORS Setting:
For sharing your file(blob), you could Set Container Public Access Level or leverage SAS to grant limited access to your file for other clients as follows:
Right click your container, select "Set Public Access Level":
Sample file for share: https://brucechen.blob.core.windows.net/brucechen/index.json
Also, you could right click your JSON file, click "Get Shared Access Signature":
Sample file for share: https://brucechen.blob.core.windows.net/brucechen/index.json?st=2017-02-28T08%3A04%3A00Z&se=2017-09-01T08%3A04%3A00Z&sp=r&sv=2015-12-11&sr=b&sig=rVkorHeNOd4j2YhkmmxZ6DfXVLf1FoN2smY6mNRIoWs%3D

Spotify API redirect URL to local filesystem?

I'm trying to write a program for myself using Spotify's api. I have no intention of my software being public, I just need access to my own playlist data. The issue is, in order to actually get this information, I need to go through Spotify's authentication process. Part of this process is a redirect URL which it sends you back to once you've logged on. The issue is, I don't actually have my code/site online, its just on my local file system. How can I open up an html file on my local filesystem using spotify's redirect url?
Note:
I tried entering a path like I would for a cmd run command such as C://Users/Me/file.html but this did not appear to work.
I'm not sure about how Spotify's API works, but there are two options that I see.
For the url, you could use file:///my-path but this might not work
Use a localhost url. An easy way to do this is python's python -m SimpleHTTPServer.
According to Spotify api you can start a server by using nodejs and assigning http://localhost:8888/callback in the white-list of the api.developer portal
remember to save after you have added it to the white list

Google Docs viewerng api reference

I am trying to show a file hosted in a public site inline on my web page using google docs by providing the following URL to an iframe.
https://drive.google.com/viewerng/viewer?url='+link+'&embedded=true
where link is the path to the file I want to show.
I am facing some issues with showing files which require user authentication.
Hence would like to see reference documentation for the API. I searched for it online was unable to find any reference documentation for the following service end point.
"https://drive.google.com/viewerng/viewer"
Let requests originating from this Google service pass your authentication
Include a secret parameter in the link to confirm that an authenticated user (of your site) is requesting the document (via viewerng)

Access Moodle webservices

I am trying to communicate with a moodle2 instance via json web service protocol. I can't get it working, no matter how long I tried. I generated an API key which I use for calling the following url in my browser:
http://<moodle base url>/webservice/rest/server.php?wsfunction=get_course_contents&wstoken=<api key>&courseid=916
As there seems to be no developer documentation for accessing the API I read the source code and found the required param coursed for this function.
Calling this URL in my browser results in a white window - server returns simply nothing but accepts my url (no 404 or something similar). The server part must be up and running because the official Moodle app can somehow communicate with the instance.
What am I doing wrong? Is there a developer documentation listing all functions and their params?
My problem was our organization not allowing me to view the administrative backend. It includes a full documentation of all functions and services.
Regrettably this documentation is not mentioned anywhere on the internet (especially not on the noodle wiki / site).