can an API product allow only certain verb:URL combinations

Paul Anderson 20 Reputation points
2023-05-23T18:31:09.0133333+00:00

suppose I have an API called WidgetsAPI. It has only one URI in it - /widget which supports GET and POST only.

GET will fetch a random already-defined widget. This is for use by developers

POST will create a new widget object and store persistently. This is for use by administrators only.

I want to have 2 products: widgetUsers and widgetAdmins, both include the WidgetsAPI, but:

  • widgetUsers includes only the /widget : GET combination
  • widgetAdmins includes only the /widget : POST combination

Can I do this in Azure APIM? If not, is there some way to accomplish this without splitting WidgetsAPI into 2 separate APIs?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,751 questions
0 comments No comments
{count} votes

Accepted answer
  1. AirGordon 7,105 Reputation points
    2023-05-23T18:39:41.84+00:00

    It depends if you want APIM to front the API's on two different URL paths or the same.

    1. The simple way is to declare two API's in APIM that target the same API, then configure each to only accept the right verb, and to be available in each product.
    2. To front just one API and differentiate through product and Http verb you'll need to write one hell of an APIM policy https://learn.microsoft.com/en-us/azure/api-management/set-backend-service-policy

0 additional answers

Sort by: Most helpful