Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

내보내기 작업 조회(Get Export Job) (V2)

내보내기 작업의 상태를 조회합니다. status.type: "succeeded"이면 필수 fileRid를 파일 다운로드에 전달합니다. failed에는 필수 오류 메시지와 선택적인 오류 코드 및 오류 인스턴스 ID가 있습니다.

작업을 만든 사용자만 접근할 수 있습니다. 내보내기 작업은 생성 후 7일 이내에 사용해야 하며 그 이후 찾을 수 없다면 자동 삭제되었을 수 있습니다.

이 엔드포인트는 미리보기 기능이며 언제든 변경되거나 제거될 수 있습니다. 사용하려면 preview=true를 지정합니다.

HTTP 요청

GET /api/v2/notepad/exportJobs/{exportJobRid}

작업 식별자는 v2.getExportJob입니다. OAuth2로 호출하는 타사 애플리케이션에는 api:notepad-export 권한 범위가 필요합니다. 각 요청에 Authorization: Bearer <접근 토큰>을 전달합니다.

경로 매개변수

이름자료형필수 여부의미와 조건예시 값
exportJobRidstring필수내보내기 작업의 고유 식별자입니다.ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c

쿼리 매개변수

이름자료형필수 여부의미와 조건예시 값
previewboolean선택미리보기 기능 사용을 활성화합니다.true

요청 본문

요청 본문을 사용하지 않습니다.

응답

응답 형식은 ExportJob입니다.

이름자료형필수 여부의미와 조건예시 값
ridstring필수내보내기 작업의 고유 식별자입니다.ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c
statusunion<running, failed, succeeded>필수내보내기 작업의 상태입니다.응답 예시 참조

status의 구조

분기 running

내보내기 작업이 실행 중입니다.

이름자료형필수 여부의미와 조건예시 값
typeenum필수허용값: running.running
분기 failed

내보내기 작업이 실패했습니다.

이름자료형필수 여부의미와 조건예시 값
typeenum필수허용값: failed.failed
errorMessagestring필수내보내기가 실패한 이유를 설명하는 오류 메시지입니다.
errorCodestring선택
errorInstanceIdstring선택
분기 succeeded

내보내기 작업이 성공했습니다.

이름자료형필수 여부의미와 조건예시 값
typeenum필수허용값: succeeded.succeeded
fileRidstring필수내보낸 콘텐츠를 담은 파일입니다.ri.notepad.main.file.cf32c039-353c-4555-9704-eacfdfaa2c1c

실행 중인 내보내기 작업의 응답 예시입니다.

{
  "rid": "ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c",
  "status": {
    "type": "running"
  }
}

개별 오류

오류 이름오류 코드HTTP의미와 조건추가 매개변수
ExportJobNotFoundNOT_FOUND404내보내기 작업을 찾을 수 없습니다.exportJobRid

요청 예제

FOUNDRY_HOST에는 https://를 제외한 호스트를, FOUNDRY_TOKEN에는 유효한 토큰을 제공합니다. 예시 식별자는 실제 작업 대상과 생성 응답에서 받은 값으로 바꿉니다.

cURL

curl --fail \
	-H "Authorization: Bearer ${FOUNDRY_TOKEN}" \
	"https://${FOUNDRY_HOST}/api/v2/notepad/exportJobs/ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c?preview=true"

Python

Requests 라이브러리가 필요합니다.

import os
import requests

HOSTNAME = os.environ["FOUNDRY_HOST"]
TOKEN = os.environ["FOUNDRY_TOKEN"]
headers = {
    "authorization": "Bearer {}".format(TOKEN)
}

response = requests.get('https://{}/api/v2/notepad/exportJobs/ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c?preview=true'.format(HOSTNAME), headers=headers)
response.raise_for_status()
print(response.json())

Java

Apache HttpClient 4.5 API를 사용하는 GetExportJobExample.java 예제입니다.

import java.io.IOException;
import org.apache.http.util.EntityUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;

public class GetExportJobExample {
    public static void main(String[] args) throws Exception {
        String HOSTNAME = System.getenv("FOUNDRY_HOST");
        String TOKEN = System.getenv("FOUNDRY_TOKEN");

        try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
            HttpGet request = new HttpGet("https://" + HOSTNAME + "/api/v2/notepad/exportJobs/ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c?preview=true");
            request.addHeader("authorization", String.format("Bearer %s", TOKEN));
            try (CloseableHttpResponse response = httpClient.execute(request)) {
                int status = response.getStatusLine().getStatusCode();
                if (status < 200 || status >= 300) throw new IOException("HTTP " + status);
                System.out.println(EntityUtils.toString(response.getEntity(), "UTF-8"));
            }
        }
    }
}

JavaScript

fetch를 제공하는 Node.js에서 사용합니다. import 또는 최상위 await를 사용하는 예제는 ES 모듈(.mjs)로 실행합니다. 서비스 사용자 토큰을 브라우저로 전달하지 않습니다.

const HOSTNAME = process.env.FOUNDRY_HOST;
const TOKEN = process.env.FOUNDRY_TOKEN;

fetch(`https://${HOSTNAME}/api/v2/notepad/exportJobs/ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c?preview=true`, {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${TOKEN}`,
    }
}).then(async (response) => {
    if (!response.ok) {
        await response.body?.cancel();
        throw new Error(`HTTP ${response.status}`);
    }
    console.log(await response.json())
});

PowerShell

오류가 발생하면 스크립트를 중단합니다.

$ErrorActionPreference = 'Stop'
$TOKEN = $env:FOUNDRY_TOKEN
$HOSTNAME = $env:FOUNDRY_HOST

$headers = @{
    "authorization" = "Bearer $TOKEN"
}

$response = Invoke-WebRequest -Uri "https://$HOSTNAME/api/v2/notepad/exportJobs/ri.notepad.main.export-job.ef32c039-353c-4555-9704-eacfdfaa2c1c?preview=true" `
	-Headers $headers

$response.content