Activate an EdgeWorker version with the API

Activate your code on the staging or production network.

Before you begin

To complete this step, you must have the edgeWorkerId for an existing function and a code bundle.
You can use the staging network to validate the behavior of your code. Once you’ve tested the functionality, you can activate it on the production network.

How to

  1. Issue a POST request with the compressed .tgz code bundle.
    POST /edgeworkers/v1/ids/{edgeWorkerId}/versions
    Note: The expected content-type header is application/gzip.

    Example HTTPie syntax:

    http --timeout=90 --auth-type edgegrid -a <authgroup>: POST :/edgeworkers/v1/ids/{edgeWorkerId}/versions Content-Type:application/gzip @<EdgeWorker Code Bundle>
    Get the version from the response object.
    {
        "edgeWorkerId": 42,
        "version": "2",
        "accountId": "A-B-1CD23",
        "checksum": "de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3",
        "sequenceNumber": 1,
        "createdBy": "jsmith",
        "createdTime": "2019-01-05T18:17:46Z"
    }
  2. Form a JSON request that specifies either the STAGING or PRODUCTION network and version number.
    {
        "network": "STAGING",
        "version": 2
    }
  3. Issue a POST request to activate your function.
    POST /edgeworkers/v1/ids/{edgeWorkerId}/activations

    Example HTTPie syntax:

    http --timeout=90 --auth-type edgegrid -a <authgroup>:  POST :/edgeworkers/v1/ids/42/activations network=STAGING version=2
    {
        "edgeWorkerId": 42,
        "version": 2,
        "activationId": 3,
        "accountId": "A-B-1CD23",
        "status": "PRESUBMIT",
        "network": "STAGING",
        "createdBy": "jsmith",
        "createdTime": "2019-01-05T18:17:46Z",
        "lastModifiedTime": "2019-01-05T18:17:46Z"
    }
    
  4. Check activation status, using the activationID from the previous step.
    GET /edgeworkers/v1/ids/{edgeWorkerId}/activations/{activationId}

    Example HTTPie syntax:

    http --timeout=90 --auth-type edgegrid -a <authgroup>:  GET :/edgeworkers/v1/ids/42/activations/3
    The activation status will be ACTIVATING, ACTIVE, BLOCKED, INACTIVE, COMPLETE, ERROR, or DEACTIVATED.
    Note: Activations can take up to thirty minutes.