Edgio

Origin Storage Quick Start Guide

This page provides an overview of methods available to upload and share your Origin Storage content.

Upload Content

There are multiple ways to ingest content using Origin Storage. Choose from the options below:
Whenever possible it is recommended that customers use the Origin Storage Application Programming Interface (API) due to its feature-rich ingest workflow and its superior performance.

Uploading Using the Origin Storage API

This section provides an end-to-end example application to jump-start client-side integration with Origin Storage. This section shows how to create a token, upload a file over HTTP, and verify that the file was correctly uploaded.
This HTTP Example ties information together, providing a complete working sample.

Step 1: Establish a Token

You can use HTTP or JSON-RPC.
HTTP Example
Use the Python requests library.
HTTP
1>>> import requests
2
3>>> auth_headers = { 'X-Agile-Username': 'guest', 'X-Agile-Password': 'password' }
4
5>>> url = 'http://{Account Name}.upload.llnw.net/account/login'
6
7>>> r = requests.post(url, headers=auth_headers, verify=False)
8
9>>> token = r.headers['x-agile-token']
10
11>>> print token
12
137c164371-d581-4068-8ce1-4d17b6a9d8a3
JSON-RPC Example
Use the Python jsonrpclib library.
JSON
1>>> import jsonrpclib
2
3>>> api = jsonrpclib.Server('http://{Account Name}.upload.llnw.net/jsonrpc2')
4
5>>> token,uid_gid = api.login('guest', 'password')
6
7>>> print token
8
9f3037573-2a6f-4042-ab8f-82d6823b0480

Step 2: Upload a File Over HTTP

Always use HTTP for file uploads! This example uses /post/raw submitted with the Python requests library.
HTTP
1>>> import requests
2
3>>> file_to_upload = "test.mp3"
4
5>>> upload_headers = { 'X-Agile-Authorization': token, 'X-Agile-Basename': file_to_upload, 'X-Agile-Directory': '/' }
6
7>>> with open(file_to_upload, 'rb') as filesrc:
8
9 r = requests.post( 'http://{Account Name}.upload.llnw.net/post/raw', data=filesrc, headers=upload_headers)

Step 3: Verify the Upload was Successful

You can use HTTP or JSON-RPC.
HTTP Example
Look at the headers returned from the request. The /post/raw request returns the upload status in the X-Agile-Status header. A value of 0 means success.
HTTP
1>>> print r.headers
2
3{'x-agile-status': '0', 'content-length': '20', 'access-control-allow-methods': 'OPTIONS',
4
5'content-type': 'text/xml;charset=utf-8', 'content-encoding': 'gzip',
6
7'x-agile-checksum': 'ce2a9d3bdec04c3577164d067e479958b50e246f17aaa098d0fad9f150eb4465',
8
9'vary': 'Accept-Encoding', 'server': 'Apache', 'date': 'Tue, 03 Mar 2015 19:31:18 GMT',
10
11'x-agile-path': '/{Account Name}/test.mp3', 'access-control-allow-origin': '*',
12
13'access-control-allow-headers': 'X-Agile-Authorization, X-Content-Type', 'x-agile-size': '2055946'}
Or, you can issue a HEAD request against the object and look at the headers returned and the overall response code (200=OK). Here is an example using the Python requests library:
HTTP
1>>> r = request.head('http://{Account Name}.upload.llnw.net/test.mp3')
2
3>>> print r
4
5<Response [200]>
6
7>>> print r.headers
8
9{‘content-length”, ‘2055946’, ‘x-agile-checksum’: 'ce2a9d3bdec04c3577164d067e479958b50e246f17aaa098d0fad9f150eb4465',
10
11’last-modified’: ‘Thu, 12 Apr 2012 19:31:18 GMT’, ‘connection’: ‘keep-alive’, ‘date’:’Tue, 03 Mar 2015 19:31:18 GMT’,
12
13 ‘accept-ranges’: ‘bytes’, ‘server’:’nginx/1.0.12, ‘content-type’: ‘audio/mpeg’}
JSON-RPC Example
Use the stat function to get information on the uploaded file. The stat function has an optional ‘detail’ parameter. Pass True for extended information, or pass False (or omit) for an abbreviated response. A value of 0 in the returned code field indicate success. Other values indicate failure. You can also look at other fields such as size and compare them to known values.
JSON
1>>> api.stat(token, '/test.mp3')
2
3{u'mtime': 1425411089, u'code': 0, u'type': 2, u'ctime': 1425411089, u'size': 2055946}
4
5>>> api.stat(token, '/test.mp3',True)
6
7{u'mimetype': u'audio/mpeg', u'code': 0, u'uid': 1000009,
8
9u'checksum': u'ce2a9d3bdec04c3577164d067e479958b50e246f17aaa098d0fad9f150eb4465',
10
11u'gid': 1000003, u'mtime': 1425411089, u'size': 2055946, u'type': 2, u'ctime': 1425411089}
Complete HTTP Example
This section ties information together, providing a complete Python working sample that you can quickly and easily copy and paste into a Python file.
Python
1import requests
2
3myusername = "guest"
4
5mypassword = "password"
6
7file_to_upload = "test.mp3"
8
9
10auth_headers = { 'X-Agile-Username': myusername, 'X-Agile-Password': mypassword }
11
12url = 'http://{Account Name}.upload.llnw.net/account/login'
13
14r = requests.post(url, headers=auth_headers, verify=False)
15
16token = r.headers['x-agile-token']
17
18
19upload_headers = { 'X-Agile-Authorization': token, 'X-Agile-Basename': file_to_upload, 'X-Agile-Directory': '/' }
20
21with open(file_to_upload, 'rb') as filesrc:
22
23 r = requests.post('http://{Account Name}.upload.llnw.net/post/raw', data=filesrc, headers=upload_headers)
24
25
26print r.headers

Uploading Using the Control Portal

You can upload using the drag-and-drop capability in the Control Portal.

Step 1: Log Into Control

  1. Go to https://control-new.edg.io/acontrol/#/login.
  2. Log in using the credentials and shortname/account information you received in your Edgio Welcome Letter.

Step 2: Create Directories

If needed, you can create target directories using the Origin Storage API or the Control portal.
Origin Storage API
APIAdditional Information in the Origin Storage API Reference Guide
makeDir or makeDir2Working with Directories in the JSON-RPC Interface
/post/directoryWorking with Directories in the HTTP Interface
Control Portal See Creating Folders in the Origin Storage Console User Guide.

Step 3: Upload Content

To upload content using the Control Portal, please see Uploading Files in the Control Portal User Guide.
If you would like to upload content using another method (API, FTP, etc.), see the links to the guides in Choose an Ingest Method.

Uploading Using Rsync over SSH

Rsync is a software application for Unix-like and Windows systems which synchronizes files and directories from one location to another, while minimizing data transfer using delta encoding, when appropriate. An important feature of Rsync not found in most protocols is that mirroring takes place with only one transmission in each direction. Rsync can copy or display directory contents and copy files, optionally using compression and recursion.
  • Rsync over SSH is available only with pre-configured Source IP Access Control List (ACL) provisioning
  • Rsync over SSH supports both pre-configured SSH authorized keys and basic password authentication
  • Rsync options that trigger mkstemp() system calls are not supported
  • The file system path accessing Origin Storage via SCP is /content
    • must be specified as the prefix when using Rsync to ingest files (e.g., Rsync filename llp:/content/path)

Rsync Options

The following options are known to work. In some cases, the options are ignored because asset ownership and permissions are dictated by the Origin Storage configuration.
The -W, and –inplace options are required.
UsageAbbreviated OptionOptionDescription
required-W-whole-filecopy files whole (without Rsync algorithm)
required-inplaceupdate destination files in-place (see man page)
optional-q-quietsuppress non-error messages
optional-no-motdsuppress daemon-mode MOTD (see man page caveat)
optional-r-recursiverecurse into directories
optional-u-updaterecurse into directories
optional-O-omit-dir-timesomit directories when preserving times
optional-i-itemize-changesoutput a change-summary for all updates
optional-r-recursiverecurse into directories
optional-t-timespreserve times
optional-u-updateskip files that are newer on the receiver
required-v-verboseincrease verbosity
optional-size-onlyskip files that match in size
optional-progressshow progress during transfer
optional-statsgive some file-transfer stats
ignored-g-grouppreserve group
ignored-o-ownerpreserve owner (super-user only)
ignored-p-permspreserve permissions

Upload Example

This example shows how to sync files from a local machine to Origin Storage.
Directory Structure Here is a simple directory structure:
Sample directory structure
Rsync Command
Here is the command to sync the directories using Rsync over SSH:
Sample directory structure2

Retrieve and Share Your Content

After you upload content, you have several options for retrieving and sharing content:
  • Use the Control Portal:
  • To download and share the content via a CDN, consult your CDN provider. Origin Storage can act as origin storage for any CDN. If Edgio Content Delivery is your CDN of choice, please see Configuring Caching and Delivery in the Control Portal User Guide.
Do not attempt to directly download content from Origin Storage using FTP, SFTP, FTPS, SCP, or rsync because doing so can negatively impact other system processes. To download content, use an HTTP GET request.