Hello EdgeTube

Hello EdgeTube API Tutorial

TIME TO COMPLETE: 10 MINS

TARGET PERSONA: DEVELOPER

Introduction

Video has become one of the most common forms of rich content on the internet. News outlets frequently embed short videos to share breaking news, sites like YouTube stream content on any topic you use, and organizations are increasingly turning to video to train, and stay connected with their employees. At the same time, 5G provides the promise of better network reliability, faster downloads, and the ability to connect more devices.

In this quickstart, you will experience the benefits of 5G using Alef’s EdgeNet services to host and stream an HD video using the EdgeNet 5G Edge APIs.

Create an EdgeNet Account

The first thing that you are going to need is an EdgeNet account. EdgeNet is Alef’s cloud service portal. EdgeNet allows you to provide subscription services. You can think of subscription services as plugins that you can configure and deploy to the Edge via Alef’s Global Edge Network. For this quickstart, we are going to use the Video Enablement subscription service to stream HD video.

The Portal also provides access to dashboards for managing that service: performance charts, usage, and debug logs. We will use these dashboards to confirm that your service is up and running successfully. In this tutorial, you will play the role of both administrator and developer. In production, these roles are typically performed by different users in your portal. As a developer, we will rely on the EdgeNet 5G Edge APIs to do most of the work for us. The EdgeNet Platform provides robust 5G Edge APIs that you can easily add to existing DevOps toolchains such as CI processes, and much more.

Because this is your first time creating an account, you will create an Organization. This is typically what an administrator will do, before adding developer accounts. You can think of an organization as the central account for your team. An organization will contain company details like address, logo, and centralized billing. Don’t worry, you don’t need to add billing information to complete the tutorial. You can always come back to the Organization profile page and add it later.

Go ahead and create an account on EdgeNet, following the guided wizard.

[IMAGE: animated gif of filling out profile page, then toggling organization to unhide additional fields.]

Once you are done, click next, skipping through the team page. Organizations allow you to quickly add team members who will have access to all the services you create in your organization. We will cover team management in another quickstart. For now, confirm your details and the terms of service, then click DONE.

Check the inbox of the email you just entered. You will receive an email from EdgeNet which contains your user id as well as your app-key. Copy this app-key as you will need it further in the tutorial when you set up the Video Enablement subscription service.

That’s it. You are now ready to start building your app.

Add Video Enablement Service

Let’s go ahead and add the Video Enablement service . This is the service that provides the capability for you to add media content such as HD videos, mp3s etc.  Since this is your first time creating a service, we also have to create an additional infrastructure service called Alef Private Edge. This service determines which edge region your organization’s subscription services are deployed. Within the My Subscriptions tile, click the +, choosing Alef Private Edge, and follow the guided wizard. For the tutorial, choose New York as the deployment location.

Now that you have the base service configured, repeat the process and add the Edge Enablement service, choosing New York as the deployment location, and calling your service Edge Enablement-Test. Once you have created your service, the final step will be to add a few configuration details. Use the table below to complete the form, then click Submit.

Field Value
Email Id pre-populated
Phone number pre-populated
Full name pre-populated
Username The username from the sign-up email.
Company name pre-populated
Whitelist Domains alefedge.com
Edge Storage Size 5
Secret Key 12345
Secret Token The token from your signup email
Tenacy Shared

 

Great! You now have your Edge services created successfully.

API Login

For the rest of the tutorial, we will use the EdgeNet APIs. To make things easy, we will use cURL to perform actions. Many developers also use tools such as Swagger to more easily build, test and debug their apps. Let’s start by logging in via the API to confirm your account is set up correctly. Within a terminal window, enter the following command, substituting the username and password with the ones you created when signing up with EdgeNet:

If successful, you should receive a response containing your API token. You can compare this with the token in the sign-up email. Everything going right, they should be the same.

Steps to perform for onboarding a partner and its content in EdgeTube.

curl --location --request POST 'https://api.qa-alefedge.com /et/api/v1/stream-tech/login' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'username=YOUR-USERNAME’ --data-urlencode 'password=YOUR-PASSWORD'
2. After login Success, you can Onboard a partner using below API.
curl --location --request POST 'https://api.qa-alefedge.com/et/api/v1/alef/stream-tech/signUp?token=<token_from_login_response>' --header 'Content-Type: application/json' --data-raw '{
"email_id": "<email_address>",
"phone_number": "+919700006530",
"full_name": "qaon",
"username": "qaon",
"partner_name": "qaon",
"cors_whitelist_domain": [
"https://demo.test.net"
],
"edge_storage_size": "1",
"secret_key": "star_secret_key",
"secret_token": "star_secret_key_token",
"tenancy" : "dedicated",
"logo": "/logo/alef.jpg"
}'
3. You can view partner details by using the API below.
curl --location --request GET 'https://api.qa-alefedge.com/et/api/v1/alef/stream-tech/get-partner-info/qaon?token=<token_from_login_response>'
4. To onboard content for the partner, you must login with the partners credentials
curl --location --request POST 'https://api.qa-alefedge.com/et/api/v1/stream-tech/login' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'username=<username>' --data-urlencode 'password=<username>A@1234'
5. Use the token from the login success to onboard content.
curl --location --request POST 'https://api.qa-alefedge.com/et/api/v1/stream-tech/content/add?token=<token_from_partner_login_response>' --header 'Content-Type: application/json' --data-raw '{
"urlList": [
{
"url": "https://d29ctshu25jfop.cloudfront.net/aa/myencoding.m3u8",
"content_access": "public",
"publish_access": "private",
"partner_cloud_url": "https://d29ctshu25jfop.cloudfront.net/aa/myencoding.m3u8"
}
]
}'
6. You can get app-key for the partner by using the same login token returned by partner login API.
curl --location --request GET 'https://api.qa-alefedge.com/et/api/v1/stream-tech/get-app-key?token=<token_from_partner_login_response>'
7. You can get all the contents for a partner
curl --location --request GET 'https://api.qa-alefedge.com/et/api/v1/stream-tech/content/get-all?token=<token_from_partner_login_response>'