删除自定义响应页面¶
1. 接口描述¶
接口请求路径:DELETE /prod-api/acdn/cloudfrontRest/deleteCustomErrorPage
deleteCustomErrorPage 用于删除指定海外 ACDN 分发下的自定义错误响应页面。
Token 获取方式见 密钥鉴权。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| distributionId | 是 | Long | Query 参数。分发主键 ID 示例值: 38 |
| errorCode | 是 | Integer | Query 参数。HTTP 错误代码 示例值: 400 |
3. 示例¶
示例1 删除自定义错误响应¶
输入示例¶
代码调用¶
请将 {登录域名}、token 替换为实际值。
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class DeleteCustomErrorPageTest {
public static void main(String[] args) throws Exception {
String url = "https://{登录域名}/prod-api/acdn/cloudfrontRest/deleteCustomErrorPage"
+ "?distributionId=38&errorCode=400";
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpDelete httpDelete = new HttpDelete(url);
httpDelete.setHeader("Authorization", "Bearer " + token);
try (CloseableHttpResponse response = httpClient.execute(httpDelete)) {
int statusCode = response.getStatusLine().getStatusCode();
String body = EntityUtils.toString(response.getEntity(), "UTF-8");
System.out.println("Status Code: " + statusCode);
System.out.println("Body: " + body);
}
}
}
}
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://{登录域名}/prod-api/acdn/cloudfrontRest/deleteCustomErrorPage?distributionId=38&errorCode=400"
token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"
req, err := http.NewRequest(http.MethodDelete, url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println("Body:", string(body))
}
输出示例¶
4. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:删除成功 |
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
| 分发ID不能为空! | 未传入 distributionId |
| 需要删除的code不能为空! | 未传入 errorCode |
| 删除失败 | 删除未成功 |