오퍼레이션
API로 파일에 실행할 수 있는 처리와 오퍼레이션별 설정입니다. 두 엔드포인트 모두 API 키가 필요 없습니다.
이 페이지의 내용
GET/v1/operationsAPI 키 필요 없음
설정 스키마를 제외한 모든 오퍼레이션을 반환합니다. 키가 필요 없으며, 누구에게나 같은 결과를 반환합니다.
쿼리 파라미터
categorystringvideo처럼 이 카테고리의 오퍼레이션만 반환합니다.최대 64자
qstringID, 이름 또는 설명에 이 단어가 포함된 오퍼레이션만 반환합니다.
최대 200자
반환값
- 200오퍼레이션 목록입니다.
필드 12개
operationsobject[]필수operations[].idstring필수video.compress같은 ID입니다.operations[].categorystring필수operations[].namestring필수operations[].descriptionstring필수operations[].groupingstring필수separate: 입력 파일마다 태스크 하나.together: 모든 입력 파일에 태스크 하나.separate또는together중 하나operations[].outputstring필수file처럼 각 태스크가 만드는 결과물입니다.operations[].max_filesinteger필수작업 하나가 받는 입력 파일의 최대 개수입니다.
최소 1
operations[].input_formatsstring[]필수받는 파일 확장자입니다.
operations[].limitsobject필수operations[].limits.max_file_bytesinteger필수입력 파일의 최대 크기(바이트)입니다.
operations[].settings_schemaobjectsettings가 따르는 JSON Schema입니다.GET /v1/operations/{id}에서만 제공됩니다.
예시
curl https://api.filesokay.com/v1/operationsconst res = await fetch("https://api.filesokay.com/v1/operations");
const list = await res.json();import requests
res = requests.get(
"https://api.filesokay.com/v1/operations",
)
list = res.json(){
"operations": [
{
"id": "video.compress",
"category": "video",
"name": "Video Compressor",
"description": "Makes videos smaller. Choose a quality level, or a target size in MB or as a percentage of each file's size.",
"grouping": "separate",
"output": "file",
"max_files": 50,
"input_formats": [
"mp4",
"m4v",
"mpg4",
"mpeg4",
"f4v",
"mov",
"qt",
"3gp",
"…"
],
"limits": {
"max_file_bytes": 53687091200
}
}
]
}GET/v1/operations/{id}API 키 필요 없음
오퍼레이션 하나를 settings가 따르는 JSON Schema와 함께 반환합니다. 키가 필요 없습니다.
경로 파라미터
idstring필수video.compress같은 오퍼레이션 ID입니다.
반환값
- 200오퍼레이션입니다.
필드 11개
idstring필수video.compress같은 ID입니다.categorystring필수namestring필수descriptionstring필수groupingstring필수separate: 입력 파일마다 태스크 하나.together: 모든 입력 파일에 태스크 하나.separate또는together중 하나outputstring필수file처럼 각 태스크가 만드는 결과물입니다.max_filesinteger필수작업 하나가 받는 입력 파일의 최대 개수입니다.
최소 1
input_formatsstring[]필수받는 파일 확장자입니다.
limitsobject필수limits.max_file_bytesinteger필수입력 파일의 최대 크기(바이트)입니다.
settings_schemaobject필수settings가 따르는 JSON Schema입니다.GET /v1/operations/{id}에서만 제공됩니다.
오류
- 404
not_found
예시
curl https://api.filesokay.com/v1/operations/video.compressconst res = await fetch("https://api.filesokay.com/v1/operations/video.compress");
const operation = await res.json();import requests
res = requests.get(
"https://api.filesokay.com/v1/operations/video.compress",
)
operation = res.json(){
"id": "video.compress",
"category": "video",
"name": "Video Compressor",
"description": "Makes videos smaller. Choose a quality level, or a target size in MB or as a percentage of each file's size.",
"grouping": "separate",
"output": "file",
"max_files": 50,
"input_formats": [
"mp4",
"m4v",
"mpg4",
"mpeg4",
"f4v",
"mov",
"qt",
"3gp",
"…"
],
"limits": {
"max_file_bytes": 53687091200
},
"settings_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Video Compressor settings",
"description": "Video Compressor's settings. A setting left out takes its default, and a job shows every setting with its default filled in. One set of settings covers every file in a job.",
"type": "object",
"additionalProperties": false,
"properties": {
"method": {
"description": "quality: choose a level, and each file's size follows from its video. target_size: choose the size to reach.",
"enum": [
"quality",
"target_size"
],
"default": "quality"
},
"level": {
"description": "With the quality method only: smaller for a smaller file, balanced, or higher for higher quality.",
"enum": [
"smaller",
"balanced",
"higher"
],
"default": "balanced"
},
"target": {
"description": "With the target_size method only: the size to reach, for each file. In MB, where 1 MB is 1,000,000 bytes, from 0.1 up to the file's own size; or as a percentage of the file's own size, from 1 to 99.",
"type": "object",
"additionalProperties": false,
"required": [
"unit",
"value"
],
"properties": {
"unit": {
"enum": [
"mb",
"percent"
]
},
"value": {
"type": "number"
}
},
"allOf": [
{
"if": {
"properties": {
"unit": {
"const": "mb"
}
}
},
"then": {
"properties": {
"value": {
"minimum": 0.1
}
}
}
},
{
"if": {
"properties": {
"unit": {
"const": "percent"
}
}
},
"then": {
"properties": {
"value": {
"minimum": 1,
"maximum": 99
}
}
}
}
],
"default": {
"unit": "percent",
"value": 60
}
},
"resolution": {
"description": "original keeps each video's size. auto, allowed only with the target_size method and its default there, lowers the size when that helps reach the target. A height lowers the video's shorter side to it, keeping the aspect ratio; a video already at or below it keeps its own size. original is the default with the quality method.",
"enum": [
"original",
"auto",
"2160",
"1440",
"1080",
"720",
"480",
"360",
"240"
]
},
"codec": {
"description": "same keeps each video's codec when its output format can hold it, and otherwise uses that format's usual codec. A chosen codec the output format can't hold falls back to the same rule.",
"enum": [
"same",
"h264",
"hevc",
"av1",
"vp9",
"mpeg4"
],
"default": "same"
},
"frame_rate": {
"description": "original keeps each video's frame rate. A number lowers it to that rate; a video already at or below it keeps its own.",
"enum": [
"original",
"60",
"30",
"24"
],
"default": "original"
},
"audio": {
"description": "keep keeps the sound; remove takes it out.",
"enum": [
"keep",
"remove"
],
"default": "keep"
},
"output_format": {
"description": "same keeps each file's own format, or gives MP4 where that format can't be written.",
"enum": [
"same",
"mp4",
"mov",
"mkv",
"webm"
],
"default": "same"
}
},
"allOf": [
{
"if": {
"required": [
"method"
],
"properties": {
"method": {
"const": "target_size"
}
}
},
"then": {
"not": {
"required": [
"level"
]
}
},
"else": {
"not": {
"anyOf": [
{
"required": [
"target"
]
},
{
"required": [
"resolution"
],
"properties": {
"resolution": {
"const": "auto"
}
}
}
]
}
}
}
]
}
}