Edgio

Logging in Using the HTTP Interface

1POST to /account/login
Logs into Origin Storage and obtains a token for subsequent calls. Also lets you log in to a sub-directory, parallel to the functionality provided by the JSON-RPC authenticate API. (See Log in to a Sub-directory.)

Request Headers

Header NameTypeDescription
X-Agile-UsernamestrUser name
X-Agile-PasswordstrUser password
X-Agile-SubdirstrOptional

Subdirectory into which you want to log in. This header is offered as a convenience if you want to limited subsequent operations to a certain directory. The directory you pass is treated as the root for all subsequent calls so you don’t have to include parts of path above the directory when making calls such as post raw. Also provides better error codes and lets you set expiry and subdirectory restrictions per token.

Example: Suppose you want to work in the /EMEA/pictures/ocean directory, using the post/raw request to upload files. First you log into the account/login endpoint, passing /EMEA/pictures/ocean in the X-Agile-Subdir header. Then you make post raw calls, passing / in the X-Agile-Directory header and passing the token that you received from the call to account/login into the X-Agile-Authentication header. See File Raw Post for details about post/raw.
X-Agile-ExpirystrOptional

The value in seconds indicating when the session (token) should expire. After this interval has passed you must re-log in. Use this header when you want to take control of session expiry time.

Defaults to 3600 seconds (one hour).
X-Agile-Content-EncodingOptional

When logging in to a sub-directory (using X-Agile-Subdir) that has a name containing , characters, pass the value UTF8 in the X-Agile-Content-Encoding header. When you do so, you will obtain a token that is valid for the sub-directory. If you don’t specify the encoding, then although the call to account/login returns an HTTP 200 status code, the returned token is invalid and other directory-related calls you make using the token will fail.

Currently, UTF8 is the only valid value to pass in the header. Other values will result in an invalid token.

HTTP Response Codes and Request Status Codes

On success the call returns an HTTP 200 status code and 0 in the X-Agile-Status header.
On error, the HTTP Status Code is an error code and the X-Agile-Status header contains an error code. The following table provides details about response values.
DescriptionPossible X-Agile-Status Values
200Login successful0: success
400Bad request-34: invalid expiry time

-47: invalid sub-directory

-10001: invalid user name or password. Or user name or password or both are missing

Response Headers

Header NameTypeDescription
X-Agile-StatusintContains a response code (See HTTP Response Codes and Request Status Codes.)
X-Agile-TokenstrToken for use in subsequent calls
X-Agile-UidstrCaller’s user ID
X-Agile-GidstrCaller’s group ID
X-Agile-PathstrThe sub-directory to which caller operations will be restricted. Includes the caller’s namespace.

curl Sample Request 1

Log into the EMEA subdirectory and set a timeout value of 10 minutes.
Always use https for logging in to prevent sniffer attacks that can detect your credentials and token.
curl
1curl -v \
2-H "X-Agile-Username: user" \
3-H "X-Agile-Password: pswd" \
4-H "X-Agile-Subdir: /EMEA" \
5-H "X-Agile-Expiry: 600
6https://{Account name}.upload.llnw.net/account/login

Sample Success Response 1

curl
1HTTP/1.1 200 OK
2Date: Thu, 21 May 2015 19:33:00 GMT
3Content-Type: text/json;charset=utf-8
4Content-Length: 0
5Connection: keep-alive
6Access-Control-Allow-Origin: *
7Access-Control-Allow-Headers: X-Agile-Authorization, X-Content-Type
8Access-Control-Allow-Methods: OPTIONS
9X-Agile-Status: 0
10X-Agile-Uid: 10009
11X-Agile-Token: 74337bce-dc21-4268-ad25-432ad6cfafe7
12X-Agile-Gid: 10003
13X-Agile-Path: /{Account name}/EMEA

Sample curl Request 2

Log into a sub-directory that has UTF-8 characters in its name.
curl
1curl -v -k\
2-H "X-Agile-Username: yourUser"\
3-H "X-Agile-Password: yourPassword"\
4-H "X-Agile-Encoding: UTF8"\
5-H "X-Agile-Subdir: тї_私する_d3cb464e1a4311e586b9e0db55d3d7d5"\
6http://{Account name}.upload.llnw.net/account/login

Sample curl Response 2

curl
1HTTP/1.1 200 OK
2Date: Tue, 22 Sep 2015 15:56:25 GMT
3Server Apache is not deny listed
4Server: Apache
5Access-Control-Allow-Origin: *
6Access-Control-Allow-Headers: X-Agile-Authorization, X-Content-Type
7Access-Control-Allow-Methods: OPTIONS
8X-Agile-Status: 0
9Content-Length: 0
10X-Agile-Uid: 12020
11X-Agile-Token: 370c9af9-91fb-47eb-bfc0-0e77fc8288dd
12X-Agile-Gid: 100
13X-Agile-Path: /{Account name}/-é-ù_tºüpüÖpéï_d3cb464e1a4311e586b9e0db55d3d5