Introduction

Edge Redirector is an Akamai Cloudlet that helps IT and marketing users more efficiently manage large numbers of redirects. By executing redirects at the Akamai Edge, you can reduce round trips to the origin and offload hits from your origin infrastructure.

The Edge Redirector OPEN API allows you to manage your Edge Redirector rules.

NOTE: If you are new to Edge Redirector, please use the Cloudlets OPEN API instead. The Cloudlets OPEN API supports all Cloudlets. The Edge Redirector API will be deprecated in the near future.

Prerequisites

Before working with this {OPEN} API, you should be familiar with the {OPEN} API Introduction.

Input/Output Formats

Request Input (POST Body Content)

Various calls may require that you pass additional content to the API (e.g., a POST Body component). For this API, you need to use the application/x-www-form-urlencoded content type in the HTTP header.

In addition, the POST content must be URL encoded.

Response Output

This API uses the JSON, JavaScript Object Notation, response format.

Network List Elements

Network List elements must be valid

  • IP addresses (v4 or v6),
  • CIDR blocks, or
  • geographic locations.

Attempts to add an IP/CIDR block to a geographic list (or vice versa) returns the 409 (Conflict error) HTTP code.

Care should be taken to avoid rate-limiting constraints. If the API caller is rate-limited, it returns the 429 (Too Many Requests) error code.

Available Actions

Action Operation API Endpoint
Policies
List Policies POST /config-edgeredirector-data/api/v1/policymanager?command=getAllPolicyInfoMaps
Create a New Policy POST /config-edgeredirector-data/api/v1/policymanager?command=create
Get a Policy POST /config-edgeredirector-data/api/v1/policymanager?command=read
Modify a Policy POST /config-edgeredirector-data/api/v1/policymanager?command=update
List Policy Information POST /config-edgeredirector-data/api/v1/policymanager?command=getPolicyInfoList
Clone a Policy POST /config-edgeredirector-data/api/v1/policymanager?command=clone
Policy Activations
Activate a Policy POST /config-edgeredirector-data/api/v1/policymanager
List Policy Activations GET /config-edgeredirector-data/api/v1/common/activation{?historyOnly}

Errors

The JSON response, like the following, is returned:

HTTP/1.1 200

Content-Type: application/json
Reply Body:
{
    "responseCode": 0,
    "i18nCode": 0,
    "englishMessage": "additional non-http specific info where relevant"
}

The returned JSON object contains a responseCode property; therefore, the caller does not have to query HTTP headers. If the responseCode is 0, the request succeeded; otherwise, the request failed.

Examples

Java Policy Example

The following is an example of an Edge Redirector policy in Java:

import java.net.URL;
import java.net.URLEncoder;
import java.util.Collections;

import org.junit.Test;

import com.akamai.edgegrid.auth.ClientCredential;
import com.akamai.edgegrid.auth.DefaultCredential;
import com.akamai.edgegrid.auth.EdgeGridV1Signer;
import com.akamai.edgegrid.auth.RequestSigner;
import com.google.api.client.http.ByteArrayContent;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpContent;
import com.google.api.client.http.HttpHeaders;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.apache.ApacheHttpTransport;

public class OpenProdReadIntegrationTest {

    @SuppressWarnings({ "unused", "unchecked" })
    @Test
    public void testRead() throws Exception {

        // Use the values from control.akamai.com
        // (CONFIGURE -> Manage APIs -> ...)
        String clientToken = "TODO";
        String accessToken = "TODO";
        String clientSecret = "TODO";
        String hostHeader = "TODO";
        String openServiceURLStart = "https://TODO.luna.akamaiapis.net";
        URL url = new URL(openServiceURLStart + "/config-edgeredirector-data/api/v1/policymanager");
        String id = "514";

        HttpTransport HTTP_TRANSPORT = new ApacheHttpTransport();
        HttpRequestFactory requestFactory = HTTP_TRANSPORT.createRequestFactory();
        String postData = "{\"policyManagerRequest\":{\"command\":\"read\",\"read\":{\"id\":\" + id + \"}}}";
        String postDataEncoded = "query=" + URLEncoder.encode(postData, "utf-8");
        byte [] contentBytes = postDataEncoded.getBytes();
        HttpContent content = new ByteArrayContent("application/x-www-form-urlencoded", contentBytes);
        HttpRequest request = requestFactory.buildPostRequest(new GenericUrl(url), content);
        HttpHeaders headers = request.getHeaders();
        headers.set("Host", hostHeader);

        ClientCredential credential = new DefaultCredential(clientToken, accessToken, clientSecret);
        RequestSigner signer = new EdgeGridV1Signer(Collections.EMPTY_LIST, 1024 * 2);
        HttpRequest signedRequest = signer.sign(request, credential);
        HttpResponse response = signedRequest.execute();
        String result = response.parseAsString();
        int breakpont = 1;
    }
}

Last modified: 8/25/2016