Revisions
Add a new revision
- Select the Star Wars API v2.
- Select the Revisions tab.
-
Add a new revision with description
Adding a caching policy.
The new revision is online but not yet current. The previous revision continues to remain the active default. Having added the new revision has not resulted in any change for your API consumers.
Add caching
- Switch to the Design tab, then select the
Get People
operation.Revision 2 automatically became the active revision you are now making changes in. You can also switch between revisions, but be aware that changes to the Current revision are live immediately.
-
Add a 10-second caching policy for the GET operation via the Code editor.
<inbound> <base /> <cache-lookup vary-by-developer="false" vary-by-developer-groups="false" allow-private-response-caching="false" must-revalidate="false" downstream-caching-type="none" /> </inbound> <backend> <base /> </backend> <outbound> <base /> <cache-store duration="10" /> </outbound>
Test the new revision
- From the Azure portal, test the
Get People
operation.Note the revision number at the top of the page as well as in the request URL.
The request URL should look similar to:https://<your-apim-name>.azure-api.net/sw/v2;rev=2/people/
. -
Test the API twice. The test trace should then show that the cache-lookup occurred.
Make current revision
- Select the Revisions tab.
-
Click on the ellipsis for
rev2
and make it the current revision. -
Choose to post to the public change log for the API and provide a meaningful update.
-
The new revision is now the current/live one. When you test now, note that the URL no longer contains a specific revision. The old revision is still online and can now be accessed with the
rev
qualifier.Unlike versioning, revisioning requires no URL updates for the API consumer.