Create Redirection V3

This API is used to create rediection policy for website acceleration or file download service.

1. Request Definition

  • API URL
https://cdn-api.swiftfederation.com/v3.0/services/{serviceId}/redirections
  • Request Method
POST
  • Request Header

Refer to HTTP Request Headers

  • Request Body

Request Body Data Format: JSON

Field Required Type Description
name Mandatory string Policy name for access control.
matchUrlPath Mandatory PolicyMatchVO URL path configuration.
matchQueryString Optional PolicyMatchVO Query string configuration.
priority Optional int Priority weight of access control policy. policy with bigger weight will have higher priority, weight value can not be zero.
redirectionURL Mandatory string Send an HTTP redirect if this policy matches.
statusCode Mandatory int HTTP response code to use if sending an HTTP redirect. Could be "301/302".
PolicyMatchVO Definition
operator Mandatory string Defines how to match the field. Supported values:prefix,regex,equals,suffix.
patterns Mandatory string[] List of patterns to match what against. If any of the patterns matches then the match succeeds.
  • Request Body Example
{
    "name": "rd3001",
    "matchUrlPath": {"operator":"prefix","patterns":["/"]},
    "matchQueryString": {"operator":"prefix","patterns":["name1=1","name2=2"]},
    "priority": 11,
    "redirectionURL": "http://www.example.com/404.html",
    "statusCode": 301
}


2. Response Definition

  • Response Header

Refer to HTTP Response Headers

  • Response Body
Field Type Description
id int Policy ID number for access control.
name string Policy name for access control.
matchUrlPath Mandatory PolicyMatchVO URL path match rule.
matchQueryString Optional PolicyMatchVO Query string match rule.
url string Prefix or regex of url pattern.
redirectionURL string Send an HTTP redirect if this policy matches.
statusCode int HTTP response code to use if sending an HTTP redirect. Could be "301/302".
PolicyMatchVO Definition
operator string Defines how to match the field. Supported values:prefix,regex,equals,suffix.
patterns string[] List of patterns to match what against. If any of the patterns matches then the match succeeds.
  • Response Body Example
{
    "id": 3001,
    "name": "rd3001",
    "matchUrlPath": {"operator":"prefix","patterns":["/"]},
    "matchQueryString": {"operator":"prefix","patterns":["name1=1","name2=2"]},
    "priority": 11,
    "redirectionURL": "http://www.example.com/404.html",
    "statusCode": 302
}
           Updated 2024-04-01 06:48:06

results matching ""

    No results matching ""