Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

개요

Kollus HTTP 업로드 Endpoint는 고객사가 업로드를 원하는 시점에 Kollus Open API의 일회성 업로드 URL 발급 API를 호출하여 획득한 업로드 URL로 HTTP multipart/form-data 형식으로 파일을 업로드하여, 이후 과정 (트랜스코딩) 을 진행토록 합니다.

...

  • 생성된 업로드 URL, 업로드 파일키는 일회용입니다.

  • 생성된 업로드 파일키는 지정된 시간 이후 자동 폐기됩니다.

요청규격

업로드 엔드포인트 생성 API

Query Parameters

  • access_token (API 접근 토큰)

업로드 URL 발급 요청시에는 다음과 같은 파라미터를 설정할 수 있습니다. Request는 Kollus API 정책에 따라 HTTP(80), POST만 HTTPS(443), POST Method만 지원합니다.

POST key

Data type

기본값

비고

expire_time

integer

600 (초)

값의 범위는 0 < expire_time <= 21600 입니다. 빈값을 보내거나 항목 자체를 제거하면 기본 600초로 설정됩니다.

category_key

string

(없음)

업로드한 파일이 속할 카테고리의 키입니다. 빈값을 보내거나 항목 자체를 제거하면 ‘없음’에 속합니다.

파일라이브 업로드의 경우 콜러스 VOD의 Kollus_FileLive 카테고리의 키를 지정합니다.

title

string

(없음)

입력한 제목을 컨텐츠의 제목으로 강제지정합니다. 이 값을 보내지 않거나 빈 값으로 보내면 기본적으로 파일명이 제목으로 사용됩니다.

is_passthrough를 1로 설정시 title은 원본파일명으로 지정됩니다.

is_encryption_upload

integer

0 (일반)

0은 일반 업로드, 1은 암호화 업로드입니다. 암호화 업로드시 파일이 암호화 되어 Kollus의 전용 플레이어로만 재생됩니다. Security-pack이 적용되지 않은 서비스 계정에서 이 값을 1로 지정하여 요청한 경우는 업로드 URL 생성이 실패합니다.

is_audio_upload

integer

0 (비디오)

0은 비디오 업로드, 1은 음원 파일 업로드 입니다.

is_multipart_upload

integer

0 (일반)

파일의 분할 업로드를 지원하기 위한 값입니다. 추후 제공될 기능이며, 현재는 동작하지 않습니다.

is_passthrough

integer

0

1은 passthrough 업로드,  0은 일반 업로드 입니다.

profile_key

string

(없음)

is_passthrough가 1인 경우 의미가 있습니다. (profile_key={계정명}-pc-high)

설정->고급기능->인코딩 프로파일에서 확인가능합니다.

selected_profile_key

String

(없음)

파일라이브의 업로드 경우에만 사용 합니다. 값 : (서비스계정키)-filelive

콜러스 라이브의 파일라이브가 활성화 상태에만 유효 합니다.



...

Code Block
languagejs
Sample
{
    "error": 0,
    "message": "",
    "result": {
        "upload_url": "http: //upload.kr.kollus.com/api/v1/UploadMultiParts/KUS_BOHG2eTQhPSIaG2511G1jfkpWOYAOjDc/20151204-dh6o2goz",
        “progress_url”: “http: //upload.kr.kollus.com/api/v1/GetUploadingProgress/KUS_BOHG2eTQhPSIaG2511G1jfkpWOYAOjDc”,
        "upload_file_key": "20141017-y4sae7td",
        "will_be_expired_at": 1413883670
    }
}
Code Block

JSON Structure Description

...

POST key

Data type

기본값

비고

return_url

string

(없음)

return_url이 주어지면 업로드 종료 후 해당 url로 redirect 합니다. 이때, result와 message값을 추가합니다.

예> http://foo.com/result.html?result=S&message=...

disable_alert

integer

0

기본적으로는 업로드 종료시 결과 메세지를 alert로 뿌려주도록 되어 있으나, 이 기능을 사용하지 않으려면 disable_alert값을 1로 하여 전송해주십시요.

redirection_scope

string

‘outer’

업로드 완료 후 redirect할 domain scope를 지정합니다. 이 옵션은 다음의 값 가운데 하나를 가질 수 있습니다.

outer → window.top.location을 이용합니다.

inner → window.location 을 이용합니다.

no → redirect 하지 않습니다.

accept

string

Request Header 가운데 Accept의 값

업로드 완료 후 전달받을 결과의 컨텐츠 타입을 지정합니다. 빈값으로 두면 text/html 방식으로 전달합니다. 이 경우는 return_url, disable_alert, redirection_scope 옵션들을 적용하여 생성된 html 페이지가 결과로 리턴됩니다. 이 값을 ‘application/json’ 형식으로 지정하면 위 세가지 옵션은 무시되며, 결과가 JSON 형식으로 리턴됩니다.

...

업로드 URL 생성 API 호출을 통해 획득한 결과 가운데 progress_url 엔트리를 참조하여 업로드 진행률을 획득합니다. (JSON 형식)

응답규격

JSON application/json; charset=UTF-8 으로 결과를 반환 합니다.

Sample

Code Block
languagejs
{
    "error": 0,
    "message": "",
    "result": {
        "upload_url": "http: //upload.kr.kollus.com/api/v1/UploadMultiParts/KUS_BOHG2eTQhPSIaG2511G1jfkpWOYAOjDc/20151204-dh6o2goz",
        “progress_url”: “http: //upload.kr.kollus.com/api/v1/GetUploadingProgress/KUS_BOHG2eTQhPSIaG2511G1jfkpWOYAOjDc”,
        "upload_file_key": "20141017-y4sae7td",
        "will_be_expired_at": 1413883670
    }
}
Code Block

JSON STRUCTURE DESCRIPTION

응답 결과 설명

  • error : 에러코드, 0이면 정상

  • message : 에러의 경우 상세 설명이 포함됩니다.

  • result : 정상인 경우 업로드 API 호출 결과를 포함 합니다.

    • upload_url : 업로드할 URL (HTTP)

    • progress_url : 업로드 진행률을 획득할 수 있는 URL (HTTP)

    • upload_file_key : 업로드 파일키

    • will_be_expired_at : upload_file_key 만료 시간 (unix timestamp)

...

에러 케이스

...

Status

Result

Cause

Solution

400

"error": "1", "message:": "failed to create upload session. invalid request"

accessToken 빈값

accessToken을 query parameter를 넣어서 요청

400

"error": "1", "message:": "The Audio profile key does not exist."

accessToken 등록이안되거나 정상적이지 않는값

accessToken이 올바른지 등록이 되였는지 확인

400

"error": "1", "message:": "The profile key does not exist."

passthrough시 해당 profile_key이 정상적으로 받지 않았을때

profile_key가 body에 넣어서 요청했는지 확인

400

"error": "1", "message:": "The profile key does not match."

passthrough시 해당 profile_key가 옳바르지 않을경우

해당 profile_key가 올바른지 확인

500

{
    "error": true,
    "message": "expired time",
    "result": {
        "type": "f",
        "upload_key": "null",
    "progress": 0
    }
}

expire 시간이 0이거나 또는 최대시간을 초과 하였을때

expire 시간을 설정을 0이상 21600이하로 설정

500

{
    "error": true,
    "message": "bad parameters",
    "result": {
        "type": "p",
        "upload_key": "null",
        "progress": 0
    }
}

upload Type의 값이 올바르지 않을경우

uploadType을 n 또는 f 로 원하는값을 맞춰야 함


200

<script>alert('Failed to upload.')</script>

upload 실패

uploadUri을 정확하게 다시 확인후 파일을업로드해야하며, form-data의 filed가 upload-file인데 정확하게 작성해서 보냈는지 확인

...

샘플코드

Upload API – ruby

Upload API – jquery

...