edit-icon download-icon

Switch an API

Last Updated: Dec 18, 2017

Description

For switching the API definition running in the specified stage to a specified historical definition, that is, replacing the running definition with a historical definition.

  • This function is intended for API activators.
  • The historical version number can be obtained through the DescribeHistoryApis interface.
  • Only definitions of APIs released more than once can be switched.
  • The definition switch can only be operated on running APIs. You must be cautious when performing this operation because the operation is reversible and takes effect immediately. The switch delay is no more than 5 seconds.
  • In essence, the switch operation is a release operation, and the reason for switch must be provided.

Request parameters

Name Type Required? Description
Action String Yes Operation interface, which is a required parameter; value: SwitchApi.
GroupId String Yes ID of the group.
ApiId String Yes ID of the API.
StageName String Yes Name of the running stage; values:
  • RELEASE: Online
  • TEST: Test
HistoryVersion String Yes Specifies the historical version number you want to switch to.
Description String Yes Switch the notes.

Return parameters

Name Type Description
RequestId String ID of the current request.

Examples

Request example

  1. https://apigateway.cn-qingdao.aliyuncs.com/?Action=SwitchApi
  2. &GroupId=63be9002440b4778a61122f14c2b2bbb
  3. &ApiId=d6f679aeb3be4b91b3688e887ca1fe16
  4. &StageName=release
  5. &HistoryVersion=20160705104552292
  6. &Description=for_demo
  7. &<Public request parameters>

Response example

XML format

  1. <SwitchApiResponse>
  2. <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BZ001</RequestId>
  3. </SwitchApiResponse>

JSON format

  1. {
  2. "RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BZ001"
  3. }
Thank you! We've received your feedback.