edit-icon download-icon

Modify an API

Last Updated: Dec 18, 2017

Description

For modifying the definition of an API.

  • The interface is intended for API activators.
  • When modifying the API name, duplicate API names in the same group are not allowed.
  • When modifying the request path, duplicate request paths in the same group are not allowed.
  • This API can call up to 50 QPS for a single user.

Request parameters

Name Type Required? Description
Action String Yes Operation interface, which is a required parameter; value: ModifyApi.
GroupId String Yes ID of the specified group.
ApiId String Yes ID of the API.
ApiName String Yes Name of the API, which is unique in the group. Names must be a string of 4–50 characters, which can contain Chinese characters, English letters, numbers, and underscores, but starts with an English letter or Chinese character.
Visibility String Yes Indicates whether the API is public; values:
  • PUBLIC: If the type is set to public, this API’s launch stage will be shown on the Discover APIs console page for all users.
  • PRIVATE: When an API group is available on the Cloud Marketplace, APIs with the private type are unavailable.
Description String Yes Description on the API, at most 180 characters.
AuthType String Yes API security authorization type; values:
  • App: Only authorized apps can call the API.
  • ANONYMOUS: The API can be called anonymously. In such a mode, you must note the following:
    • Anyone who can obtain this API service information can call this API. The gateway does not authenticate the identity of callers and cannot set traffic limits for individual users. If you activate this API, set API-based throttling.
    • ANONYMOUS API: We recommend that you not make anonymous APIs available on the Cloud Marketplace. The gateway cannot meter callers separately and cannot control the number of calls. If the group including this API is to be added to the Cloud Marketplace, we suggest you move this API to another group, set its type to private, or select the Alibaba Cloud App certification method.
RequestConfig String Yes Configuration items of the API request sent by a consumer to the gateway.
ServiceConfig String Yes Configuration items of the API request sent by the gateway to a backend service.
RequestParameters String Yes Description on parameters of the API request sent by a consumer to the gateway.
ServiceParameters String Yes Description on parameters of the API request sent by the gateway to a backend service.
ServiceParametersMap String Yes The mappings between parameters of a request sent by a consumer to the gateway and parameters of a request sent by the gateway to a backend service.
ResultType String Yes Format of the reply returned by the backend service. Currently, allowed formats are JSON, TEXT, BINARY, XML, and HTML.
ResultSample String Yes Sample of the reply returned by the backend service.
FailResultSample String No Sample of the reply failure returned by the backend service.
ErrorCodeSamples String No Sample of the error code returned by the backend service.

Return parameters

Name Type Description
RequestId String ID of the current API creation request

Examples

Request example

  1. https://apigateway.cn-qingdao.aliyuncs.com/?Action=ModifyApi
  2. &GroupId=08ae4aa0f95e4321849ee57f4e0b3077
  3. &ApiName=ApiName
  4. &ApiId=8afff6c8c4c6447abb035812e4d66b65
  5. &Visibility=PUBLIC
  6. &Description=Api description
  7. &AuthType=APP
  8. &RequestConfig={"RequestProtocol":"HTTP","RequestHttpMethod":"GET","RequestPath":"/v3/getUserTest/[userId]","BodyFormat":"FORM","PostBodyDescription":""}
  9. &ServiceConfig={"ServiceProtocol":"HTTP","ServiceHttpMethod":"GET","ServiceAddress":"http://www.customerdomain.com","ServiceTimeout":"1000","ServicePath":"/v3/getUserTest/[userId]"}
  10. &RequestParamters=[{"ParameterLocation":{"name":"Head","orderNumber":1},"ParameterType":"Number","Required":"OPTIONAL","isHide":false,"ApiParameterName":"age","DefaultValue":"20","DemoValue":"20","Description":" Age","MinValue":18,"MaxValue":100,"Location":"Head"},{"ParameterLocation":{"name":"Query","orderNumber":2},"ParameterType":"String","Required":"OPTIONAL","isHide":false,"ApiParameterName":"sex","DefaultValue":"boy","DemoValue":"boy","Description":" Gender","EnumValue":"boy,girl","Location":"Query"},{"ParameterLocation":{"name":"Parameter Path","orderNumber":3},"ParameterType":"Number","Required":"REQUIRED","isHide":false,"ApiParameterName":"userId","MaxLength":10,"MinValue":10000000,"MaxValue":100000000,"Location":"Path"},{"ApiParameterName":"CaClientIp","ParameterLocation":{"name":"Head","orderNumber":0},"Location":"Head","ParameterType":"String","Required":"REQUIRED","Description":" Client IP address"},{"ApiParameterName":"constance","ParameterLocation":{"name":"Head","orderNumber":0},"Location":"Head","ParameterType":"String","Required":"REQUIRED","DefaultValue":"constance","Description":"constance"}]
  11. &ServiceParameters=[{"ServiceParameterName":"age","Location":"Head","Type":"Number","ParameterCatalog":"REQUEST"},{"ServiceParameterName":"sex","Location":"Query","Type":"String","ParameterCatalog":"REQUEST"},{"ServiceParameterName":"userId","Location":"Path","Type":"Number","ParameterCatalog":"REQUEST"},{"ServiceParameterName":"clientIp","Location":"Head","Type":"String","ParameterCatalog":"SYSTEM"},{"ServiceParameterName":"constance","Location":"Head","Type":"String","ParameterCatalog":"CONSTANT"}]
  12. &ServiceParametersMap=[{"ServiceParameterName":"age","RequestParameterName":"age"},{"ServiceParameterName":"sex","RequestParameterName":"sex"},{"ServiceParameterName":"userId","RequestParameterName":"userId"},{"ServiceParameterName":"clientIp","RequestParameterName":"CaClientIp"},{"ServiceParameterName":"constance","RequestParameterName":"constance"}]
  13. &ResultType=HTML
  14. &ResultSample=200
  15. &<Public request parameters>

Response example

XML format

  1. <ModifyApiResponse>
  2. <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
  3. </ModifyApiResponse>

JSON format

  1. {
  2. "RequestId":"6C87A26A-6A18-4B8E-8099-705278381A2C"
  3. }
Thank you! We've received your feedback.