Setting sunset header in the API response

suvra jyoti 156 Reputation points
2021-08-19T06:55:41.393+00:00

There would be different teams that would be publishing their APIs in our API Management instance. We need to set sunset header in response. I understand we can do so in the Outbound policies of each Product/API/Operation(as per requirement the scope will be different) using the return response policy: https://learn.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#ReturnResponse.

We would need to do the above manually. Is there some way we make it configurable such that different teams wanting to publish can select the scope i.e. the Product/API/Operation and set the sunset header as per the requirements so that manually going and putting in the policy in the azure api management is not required.

Do we need to create a custom task in which different teams publishing apis can se the scope(Product/API/Operation) and apply the policy that set the sunset header in the return response policy : https://learn.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#ReturnResponse. If we go by the custom task , do we need to create separate tasks for Product, API and Operation level? What about existing APIs that already have a policy applied, in that case how do we handle.?

Any inputs in this direction is much appreciated.

Thanks,
SuvraJyoti

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

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2021-08-23T10:05:47.603+00:00

    @suvra jyoti If your different team can return the response/header with the sunset details for their respective APIs then the APIM can pass the same to your end user if you are not transforming the backend response with any of your custom policy. But in case if your backend APIs doesn't response with the sunset details then inidividual team need to create their own custom policy to change/add the sunset response according to their sunset time.

    The best option would be your backend API's returning the sunset details so the APIM can pass the same backend response to the end users.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.