Add data to your EdgeKV database

Before you start, make sure you've created and initialized an EdgeKV database. You can perform the one-time EdgeKV database initialization using the API or CLI. This initializes the EdgeKV database on both staging and production. It also creates a “default” namespace on both staging and production.

The next step is to populate that database with data that can be consumed by your EdgeWorkers function. To do this, you can use the Administrative API or CLI to create an item (a key-value pair).

🚧

Warning!

EdgeKV is a distributed key-value store that enables JavaScript developers to build data-driven EdgeWorkers applications for latency-sensitive use cases. The current release of EdgeKV is not designed for handling personal, confidential, proprietary data, or any other type of data where unauthorized access to or disclosure of such data would result in loss, legal or regulatory liability, or other harm to Customers or their end users (“Sensitive Data”). EdgeKV should not, therefore, be used to store Sensitive Data. In addition, do not use data returned from EdgeKV to influence workflows that are in scope for compliance frameworks which mandate specific requirements for the handling of Sensitive Data without conducting an appropriate impact review. Customers of EdgeKV are responsible for maintaining control over the data loaded into EdgeKV and for review of applicable information security, privacy, and compliance requirements to determine the appropriateness of their use of this service.

This example shows you how to populate your EdgeKV database. Go to the getting-started section in the EdgeKV Hello World readme file for more information.

👍

EdgeWorkers functions running on the production network can only be used with EdgeKV namespaces created on the production network. Similarly, EdgeWorkers running on the staging network can only access EdgeKV namespaces created on the staging network. This is to ensure separation of concerns for security reasons.

Add data using the API

You can also specify where to add the the various language specific greetings to your EdgeKV store using the networks/{network} path in the API endpoint.

METHOD | ENDPOINT                                             | Data
------ | -----------------------------------------------------| -----------------
PUT    | /edgekv/v1/networks/staging/namespaces/default/groups/greetings/items/en | "Hello World"
PUT    | /edgekv/v1/networks/staging/namespaces/default/groups/greetings/items/fr | "Bonjour le Monde"
PUT    | /edgekv/v1/networks/staging/namespaces/default/groups/greetings/items/es | "Hola Mundo"

For a complete list of EdgeKV endpoints refer to the EdgeKV API documentation.

Add data using the EdgeKV CLI

You can specify either staging or production environment using the parameter.

akamai edgekv write text staging default greetings en "Hello World" 
akamai edgekv write text staging default greetings fr "Bonjour le Monde" 
akamai edgekv write text staging default greetings es "Hola Mundo"

For a complete list of CLI commands refer to the CLI documentation.

📘

Due to the eventual consistency properties of the EdgeKV store, your data update may take up to 10 seconds to be reflected in the response of a subsequent GET request.


Did this page help you?