Mounts a script to an application or application instance group.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only the common request header. For more information, see Common request parameters.

Request syntax

POST /pop/app/config_app_hook_json HTTPS|HTTP

Request parameters

Parameter Type Position Required Example Description
AppId String Query Yes d498****-1dd8ec229862

The ID of the application.

Hooks String Query Yes [{"ignoreFail":false,"name":"postprepareInstanceEnvironmentOnScaleOut","script":"ls"}]

The script to mount. Set the value in the JSON format. Example:

[{"ignoreFail":false,"name":"postprepareInstanceEnvironmentOnScaleOut","script":"ls"},{"ignoreFail":true,"name":"postdeleteInstanceDataOnScaleIn","script":""},{"ignoreFail":true,"name":"prestartInstance","script":""},{"ignoreFail":true,"name":"poststartInstance","script":""},{"ignoreFail":true,"name":"prestopInstance","script":""},{"ignoreFail":true,"name":"poststopInstance","script":""}]
GroupId String Query No d498****-1dd8ec229862

The ID of the application instance group.

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

HooksConfiguration Array of Configuration

The mounted script.

IgnoreFail Boolean true

Indicates whether a mount failure is ignored. Valid values:

  • true: A mount failure is ignored.
  • false: A mount failure is not ignored.
Name String postprepareInstanceEnvironmentOnScaleOut

The name of the mounted script.

Script String ls

The content of the mounted script.

Message String success

The response message.

RequestId String d498****-1dd8ec229862

The ID of the request.

Examples

Sample requests

POST /pop/app/config_app_hook_json HTTP/1.1
Common request parameters
{
"AppId": "d498****-1dd8ec229862",
"Hooks": "[{"ignoreFail":false,"name":"postprepareInstanceEnvironmentOnScaleOut","script":"ls"}]"
}

Sample success responses

XML format

<HooksConfiguration>
    <Script>ls</Script>
    <IgnoreFail>true</IgnoreFail>
    <Name>postprepareInstanceEnvironmentOnScaleOut</Name>
</HooksConfiguration>
<Message>success</Message>
<RequestId>d498****-1dd8ec229862</RequestId>
<Code>200</Code>

JSON format

{
    "HooksConfiguration": {
        "Script": "ls",
        "IgnoreFail": true,
        "Name": "postprepareInstanceEnvironmentOnScaleOut"
    },
    "Message": "success",
    "RequestId": "d498****-1dd8ec229862",
    "Code": 200
}

Error codes

HttpCode Error code Error message Description
500 Edas.errorcode.PermissionDenied.message You are not authorized to perform the operation. The error message returned because you are not authorized to perform the operation.

For a list of error codes, visit the API Error Center.