Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

쿼리 유형 목록(List Query Types) (V1)

온톨로지에 정의된 쿼리 유형을 페이지 단위로 조회합니다.

위치이름자료형필수 여부의미
경로ontologyRidstring필수쿼리 유형이 속한 온톨로지 RID
쿼리pageSizeinteger선택원하는 페이지 크기. 기본값 100
쿼리pageTokenstring선택이전 응답의 nextPageToken. 첫 요청에서는 생략

온톨로지 RID는 List Ontologies나 Ontology Manager에서 확인합니다. 요청 본문은 없습니다. 페이지는 요청한 크기보다 작을 수 있지만, 결과가 더 남아 있다면 현재 응답에 최소 한 항목이 포함됩니다. 다음 페이지의 토큰을 받아 요청을 이어갑니다.

ListQueryTypesResponse의 nextPageToken 문자열과 data: list<QueryType>은 선택 항목입니다. 각 항목의 전체 필드, 매개변수와 출력 자료형은 QueryType을 따릅니다.

가상 예시는 도시별 직원 조회 함수와 재직 기간 통계 함수입니다. 두 번째 함수의 employees는 String 매개변수이며 직원 집합을 입력 대상으로 설명합니다. 선택 매개변수 useMedian은 이 예시 함수에서 생략하면 false이고, true이면 평균 대신 중앙값을 사용합니다. 이 기본값은 해당 함수의 설정입니다.

HTTP 요청

GET /api/v1/ontologies/{ontologyRid}/queryTypes

작업 식별자는 v1.listQueryTypes입니다. Authorization: Bearer <접근 토큰> 헤더로 인증합니다. OAuth 클라이언트에는 api:ontologies-read 권한 범위가 필요합니다.

JSON 응답 예시

가상 온톨로지의 응답 예시입니다.

{
  "nextPageToken": "v1.QnVpbGQgdGhlIEZ1dHVyZTogaHR0cHM6Ly93d3cucGFsYW50aXIuY29tL2NhcmVlcnMvP2xldmVyLXNvdXJjZSU1YiU1ZD1BUElEb2NzI29wZW4tcG9zaXRpb25z",
  "data": [
    {
      "apiName": "getEmployeesInCity",
      "displayName": "Get Employees in City",
      "description": "Gets all employees in a given city",
      "parameters": {
        "city": {
          "baseType": "String",
          "description": "The city to search for employees in",
          "required": true
        }
      },
      "output": {
        "type": "array",
        "itemType": {
          "type": "object",
          "objectApiName": "Employee",
          "objectTypeApiName": "Employee"
        }
      },
      "rid": "ri.function-registry.main.function.f05481407-1d67-4120-83b4-e3fed5305a29b",
      "version": "1.1.3-rc1"
    },
    {
      "apiName": "getAverageTenureOfEmployees",
      "displayName": "Get Average Tenure",
      "description": "Gets the average tenure of all employees",
      "parameters": {
        "employees": {
          "baseType": "String",
          "description": "An object set of the employees to calculate the average tenure of",
          "required": true
        },
        "useMedian": {
          "baseType": "Boolean",
          "description": "An optional flag to use the median instead of the mean, defaults to false",
          "required": false
        }
      },
      "output": {
        "type": "double"
      },
      "rid": "ri.function-registry.main.function.9549c29d3-e92f-64a1-beeb-af817819a400",
      "version": "2.1.1"
    }
  ]
}

오류

실패 응답은 공통 API 오류의 형식으로 처리합니다.

요청 예제

FOUNDRY_HOST에는 https://를 제외한 Foundry 호스트를, FOUNDRY_TOKEN에는 유효한 토큰을 환경 변수로 제공합니다. 아래 식별자와 입력값은 예시이므로 실제 요청 대상에 맞게 지정합니다.

cURL

curl \
	-H "Authorization: Bearer ${FOUNDRY_TOKEN}" \
	"https://${FOUNDRY_HOST}/api/v1/ontologies/ri.ontology.main.ontology.c61d9ab5-2919-4127-a0a1-ac64c0ce6367/queryTypes"

Python

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

import os
import requests

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

response = requests.get('https://{}/api/v1/ontologies/ri.ontology.main.ontology.c61d9ab5-2919-4127-a0a1-ac64c0ce6367/queryTypes'.format(HOSTNAME), headers=headers)
print(response)

Java

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

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 ListQueryTypesExample {
    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/v1/ontologies/ri.ontology.main.ontology.c61d9ab5-2919-4127-a0a1-ac64c0ce6367/queryTypes");
            request.addHeader("authorization", String.format("Bearer %s", TOKEN));
            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/v1/ontologies/ri.ontology.main.ontology.c61d9ab5-2919-4127-a0a1-ac64c0ce6367/queryTypes`, {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${TOKEN}`,
    }
}).then((response) => {
    console.log(response)
});

PowerShell

$TOKEN = $env:FOUNDRY_TOKEN
$HOSTNAME = $env:FOUNDRY_HOST

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

$response = Invoke-WebRequest -Uri "https://$HOSTNAME/api/v1/ontologies/ri.ontology.main.ontology.c61d9ab5-2919-4127-a0a1-ac64c0ce6367/queryTypes" `
	-Headers $headers

$response.content