In Azure API Management, When the client calls the API, the subscription key should be passed with the name "Ocp-Apim-Subscription-Key" in the header. Can we change this name to something else?
got the answer, we can change the header name. but as of now its only supported from API.
https://social.msdn.microsoft.com/Forums/azure/en-US/35af319b-2f2c-4ccb-91ef-3f526aa07a2b/azure-api-management-can-we-change-the-header-name?forum=azureapimgmt#35af319b-2f2c-4ccb-91ef-3f526aa07a2b
Related
I am trying to create api and expose them via APIM. The path of the api that I expect is
baseUrl/v1/Product/Upload.
But when i try to use versioning of APIM, I could only come up with something like
baseUrl/Product/v1/Upload, where Product is API url suffix.
Is there a way in APIM to change the order in which version number is placed in the url path.
Every API Developer will have their own requirement of versioning. So Azure API Management provide several options instead of a single approach to versioning. And Path-based versioning is one of those options.
If you check this Path-based versioning section of Microsoft document then you will find -
When the path versioning scheme is used, the version identifier needs to be included in the URL path for any API requests.
The format of an API request URL when using path-based versioning is as follows.
https://{yourDomain}/{apiName}/{versionIdentifier}/{operationId}
It is recommended to follow this format but if you want to modify it you can use the API Management transformation policies. The rewrite-uri policy converts a request URL from its public form to the form expected by the web service.
Read this Rewrite URL and Policy Expressions in Azure API Management document for more information.
I would like to avoid providing Subscription Key for a single endpoint in my API. So far I found that I can disable Subscription for whole Product or API, which is not what I want. Is this even possible?
The only way which comes to my mind is another API and Product with exposed inly this single endpoint (obviously without subscription).
Summarize from the comments, currently we can't implement your requirement of disable "subscription" for one endpoint of api in APIM.
The workaround is what you mentioned to create another api or product for the endpoint and disable the "subscription".
And another workaround is disable the "subscription" for all of endpoints in api, and add a query parameter(or header parameter) for the endpoint(except the only one endpoint) as "subscription key". Then check the subscription key in "inbound" policy of most endpoints.
For this feature, you can also create a ticket on azure feedback page to suggest azure develop team add it.
I have single azure function app. I want to create 2 different API endpoints in Azure APIM. How I can do that?
According to some test, it seems we can't implement the requirement by adding an operation in api management because it will show error message Operation with the same method and URL template already exists.
And if we use some other methods such as clone the operation, it will also fail with 404 error because the URL field will change and can not match the function url.
So I think you can just add another api in your api management to implement the requirement (shown like below screenshot).
The two APIM endpoints should be:
https://huryapim.azure-api.net/huryFun1/HttpTrigger1 and https://huryapim.azure-api.net/huryFun2/HttpTrigger1. Both of them request the same azure function url in backend.
I have one AZURE Apim which is mapped to App service where I have deployed web API's(separate API for each customer).
I have added an API URL prefix(Customer Name) in APIM endpoint so that I can define endpoints based on the customer as below.
APIM URL: http://demoapim.com
apim URL prefix : customer name(cust1, cust2)
so now URL would be
http://demoapim.com/cust1
http://demoapim.com/cust2
web API endpoint: http://cutomerapi.com/details
When I am trying to access http://demoapim.com/cust2/details or http://demoapim.com/cust1/details,
it gives 404.but http://demoapim.com/details works.
Please help me what I am missing here.
After understanding apim, I have the following points, I hope it can be helpful to you.
No matter how many apim URL prefixes, cust1, cust2 and so on you have set. The final access address is /cust1/details, the route of this address is not recognized in webapp services. So the problem now arises.
So I think the problem should not be in apim services, what you should pay attention to is your webapp services. You can rewrite the url or identify cust1 or cust2 for the access request and return the corresponding data.
URL Rewrite eg.
Your original URL:
http://demoapim.com/cust2-details
Final URL:
http://demoapim.com?cust=cust2&title=details
Using url rewrite in webapp services will better meet your business needs.
I have an enpoint in my MERN app which I would like to expose to developers.
I came across APIM and would like to use it.
After going to the documentation I would like to know how do I can use APIM for my specific enpoint and where I allow users to generate API's in my client side react app.
I am also going through the API management API. but don't know how to generate user specific API keys...
You could simply mimic what the Developer Portal does using APIMs REST API.
If you are using the Consumption Tier of APIM, you can just create a standalone subscription using the Create or Update Subscription API. Yon don't have to set properties.ownerId in the request payload here.
On the other tiers, standalone subscriptions are not supported yet (but will be as mentioned in the official announcement blog under New Features), so you will have to create a user first using the Create or Update User API and then create a new subscription mentioning this user under properties.ownerId as /users/{userId}.
Since these REST APIs call the Azure Management API, you shouldn't be making these requests from the client and instead should be calling this from your backend.