템플릿 미리보기 변환
curl --request POST \
--url https://resource-dot-edicusbase.appspot.com/resapi/preview \
--header 'Content-Type: multipart/form-data' \
--header 'edicus-api-key: <api-key>' \
--form meta=@example-file \
--form doc=@example-file \
--form 'dir=<string>' \
--form dpi=300 \
--form bound_mode=showimport requests
url = "https://resource-dot-edicusbase.appspot.com/resapi/preview"
files = {
"meta": ("example-file", open("example-file", "rb")),
"doc": ("example-file", open("example-file", "rb"))
}
payload = {
"dir": "<string>",
"dpi": "300",
"bound_mode": "show"
}
headers = {"edicus-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('meta', '<string>');
form.append('doc', '<string>');
form.append('dir', '<string>');
form.append('dpi', '300');
form.append('bound_mode', 'show');
const options = {method: 'POST', headers: {'edicus-api-key': '<api-key>'}};
options.body = form;
fetch('https://resource-dot-edicusbase.appspot.com/resapi/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://resource-dot-edicusbase.appspot.com/resapi/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"edicus-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://resource-dot-edicusbase.appspot.com/resapi/preview"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("edicus-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://resource-dot-edicusbase.appspot.com/resapi/preview")
.header("edicus-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://resource-dot-edicusbase.appspot.com/resapi/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["edicus-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"pageInfos": [
{
"svg": "<string>",
"layers": [
{
"type": "<string>",
"svg": "<string>"
}
]
}
],
"unregistered_fonts_found": [
"<string>"
],
"unresolved_font_group_ids": [
"<string>"
]
}"no template"{
"code": "invalid-edicus-api-key"
}{}템플릿
템플릿 미리보기 변환
InDesign 템플릿을 edicus-doc으로 변환하고 미리보기용 SVG를 받는다. 등록하지 않고 결과만 확인할 때 쓴다.
결과로 오는 SVG의 내부 이미지는 로컬 절대경로 xlink로 되어 있다.
unresolved_font_group_ids에 값이 있으면, 해당 상품 코드에 적용된 font class와 InDesign JSON의 textframe에 표시된 div·lang 정보를 조합한 font group id(fontclass-div-lang 패턴)가 Edicus Manager에 만들어져 있지 않은 경우다.
POST
/
resapi
/
preview
템플릿 미리보기 변환
curl --request POST \
--url https://resource-dot-edicusbase.appspot.com/resapi/preview \
--header 'Content-Type: multipart/form-data' \
--header 'edicus-api-key: <api-key>' \
--form meta=@example-file \
--form doc=@example-file \
--form 'dir=<string>' \
--form dpi=300 \
--form bound_mode=showimport requests
url = "https://resource-dot-edicusbase.appspot.com/resapi/preview"
files = {
"meta": ("example-file", open("example-file", "rb")),
"doc": ("example-file", open("example-file", "rb"))
}
payload = {
"dir": "<string>",
"dpi": "300",
"bound_mode": "show"
}
headers = {"edicus-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('meta', '<string>');
form.append('doc', '<string>');
form.append('dir', '<string>');
form.append('dpi', '300');
form.append('bound_mode', 'show');
const options = {method: 'POST', headers: {'edicus-api-key': '<api-key>'}};
options.body = form;
fetch('https://resource-dot-edicusbase.appspot.com/resapi/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://resource-dot-edicusbase.appspot.com/resapi/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"edicus-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://resource-dot-edicusbase.appspot.com/resapi/preview"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("edicus-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://resource-dot-edicusbase.appspot.com/resapi/preview")
.header("edicus-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://resource-dot-edicusbase.appspot.com/resapi/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["edicus-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"meta\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"doc\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dir\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dpi\"\r\n\r\n300\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bound_mode\"\r\n\r\nshow\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"pageInfos": [
{
"svg": "<string>",
"layers": [
{
"type": "<string>",
"svg": "<string>"
}
]
}
],
"unregistered_fonts_found": [
"<string>"
],
"unresolved_font_group_ids": [
"<string>"
]
}"no template"{
"code": "invalid-edicus-api-key"
}{}Authorizations
모션원에서 발급받는 API 키입니다. 외부에 유출되지 않도록 각별히 주의합니다.
Body
multipart/form-data
metadata.json
template.json
template.json이 있는 로컬 절대 폴더 경로
SVG 생성에 쓸 dpi
RenderBound 레이어가 있을 때의 처리. show: 전체 영역 미리보기와 RenderBound 표시, cut: RenderBound만 미리보기, none: 전체 영역 미리보기, RenderBound 표시 없음
Available options:
show, cut, none