Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

폴더 배치 조회(Get Folders Batch) (V2)

최대 1,000개 폴더 RID를 한 번에 조회합니다. 본문은 folderRid를 가진 항목들의 배열이고, 응답은 폴더 RID와 Folder를 대응시킨 맵입니다.

이 POST는 조회 작업입니다. 결과를 배열 순서로 대응시키지 않고 맵의 RID를 사용합니다.

HTTP 요청

POST /api/v2/filesystem/folders/getBatch

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

경로 매개변수

지정할 경로 매개변수가 없습니다.

쿼리 매개변수

지정할 쿼리 매개변수가 없습니다.

요청 본문

본문 형식은 list<GetFoldersBatchRequestElement>이며 필수입니다.

배열 항목은 GetFoldersBatchRequestElement이며 자료형은 object입니다.

이름자료형필수 여부의미와 조건예시 값
folderRidstring필수폴더의 고유 리소스 식별자(RID)입니다.ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8

다음 본문의 식별자와 값은 가상 예시입니다.

[
  {
    "folderRid": "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8"
  }
]

응답

응답 형식은 GetFoldersBatchResponse입니다.

data는 map<FolderRid, Folder>이며 각 키는 대응하는 Folder의 RID입니다.

이름자료형필수 여부의미와 조건예시 값
datamap<FolderRid, Folder>선택

data의 구조

맵의 키는 FolderRid(string), 값은 Folder(object)입니다.

키: 폴더의 고유 리소스 식별자(RID)입니다.

Folder의 14개 필드, 3가지 폴더 유형과 소속 및 휴지통 상태는 Folder 자료형을 따릅니다.

가상 폴더 배치의 응답 예시입니다.

{
  "data": {
    "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8": {
      "projectRid": "ri.compass.main.folder.4cae7c13-b59f-48f6-9ef2-dbde603e4e33",
      "updatedTime": "2024-09-25T17:29:35.974Z",
      "updatedBy": "f05f8da4-b84c-4fca-9c77-8af0b13d11de",
      "displayName": "My Folder",
      "description": "Empyrean Airlines project working folder",
      "rid": "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8",
      "type": "FOLDER",
      "spaceRid": "ri.compass.main.folder.a86ad5f5-3db5-48e4-9fdd-00aa3e5731ca",
      "trashStatus": "NOT_TRASHED",
      "parentFolderRid": "ri.compass.main.folder.4cae7c13-b59f-48f6-9ef2-dbde603e4e33",
      "path": "/Empyrean Airlines/My Important Project/My Folder",
      "createdBy": "f05f8da4-b84c-4fca-9c77-8af0b13d11de",
      "createdTime": "2024-09-25T17:29:35.974Z"
    }
  }
}

개별 오류

오류 응답 처리는 공통 API 오류 계약을 따릅니다.

요청 예제

FOUNDRY_HOST에는 https://를 제외한 Foundry 호스트를, FOUNDRY_TOKEN에는 유효한 토큰을 환경 변수로 제공합니다. 예시 식별자와 매개변수 값은 실제 작업 대상에 맞게 바꿉니다.

cURL

curl -X POST \
	-H "Content-type: application/json" \
	-H "Authorization: Bearer ${FOUNDRY_TOKEN}" \
	"https://${FOUNDRY_HOST}/api/v2/filesystem/folders/getBatch" \
	-d '[{"folderRid":"ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8"}]'

Python

Requests 라이브러리가 설치된 Python 환경에서 사용합니다.

import os
import requests

HOSTNAME = os.environ["FOUNDRY_HOST"]
TOKEN = os.environ["FOUNDRY_TOKEN"]
headers = {
    "content-type": "application/json",
    "authorization": "Bearer {}".format(TOKEN)
}
request_body = [
    {
        "folderRid": "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8"
    }
]

response = requests.post('https://{}/api/v2/filesystem/folders/getBatch'.format(HOSTNAME), headers=headers, json=request_body)
print(response)

Java

Apache HttpClient 4.5 API와 try-with-resources를 사용합니다. 클래스 이름에 맞는 GetFoldersBatchExample.java 파일에서 사용합니다.

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;

public class GetFoldersBatchExample {
    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()) {
            HttpPost request = new HttpPost("https://" + HOSTNAME + "/api/v2/filesystem/folders/getBatch");
            request.addHeader("content-type", "application/json");
            request.addHeader("authorization", String.format("Bearer %s", TOKEN));
            request.setEntity(new StringEntity("[{\"folderRid\":\"ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8\"}]", ContentType.APPLICATION_JSON));
            try (CloseableHttpResponse response = httpClient.execute(request)) {
                System.out.println(response);
            }
        }
    }
}

JavaScript

fetch를 제공하는 Node.js 환경에서 사용합니다. 서비스 사용자 토큰을 브라우저로 전달하지 않습니다.

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

fetch(`https://${HOSTNAME}/api/v2/filesystem/folders/getBatch`, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${TOKEN}`,
    },
    body: '[{"folderRid":"ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8"}]'
}).then((response) => {
    console.log(response)
});

PowerShell

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

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

$response = Invoke-WebRequest -Uri "https://$HOSTNAME/api/v2/filesystem/folders/getBatch" `
	-Method Post `
	-Headers $headers `
	-ContentType application/json `
	-Body "[{`"folderRid`":`"ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8`"}]"

$response.content