Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

apiConfig는 실제 API 동작을 정의하는데 사용하며, configId 에 따라서 API Response 형태가 결정된다.

...

response type

Expand
titleall : 전체 응답 필드를 바이패스
Code Block
{
  "typeId": "api",
  "category": "snack",
  "apiId": "list",
  "apiName": "snack List",
  "apiType": "service",
  "method": "GET",
  "parameters": [
  ],
  "statistic": true,
  "aggregation": false,
  "root": {
    "configId": "root",
    "tid": "snack",
    "type": "query",
    "query": [
      {
        "method": "matching",
        "field": "name",
        "value": "{{:name}}"
      }
    ],
    "response": [
      {
        "field": "_all_",
        "type": "all"
      }
    ]
  }
}
Code Block
{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 1,
    "totalTypeCount": 20,
    "resultCount": 1,
    "items": [
        {
            "id": "103",
            "label": "오레오",
            "name": "오레오"
        }
    ]
}
Expand
titlefield : fieldId와 동일한 응답 항목 매핑
Code Block
{
  "typeId": "api",
  "category": "snack",
  "apiId": "list",
  "apiName": "snack List",
  "apiType": "service",
  "method": "GET",
  "parameters": [
  ],
  "statistic": true,
  "aggregation": false,
  "root": {
    "configId": "root",
    "tid": "snack",
    "type": "query",
    "query": [
      {
        "method": "matching",
        "field": "name",
        "value": "{{:name}}"
      }
    ],
    "response": [
      {
        "field": "id",
        "type": "field",
        "value": ""
      }
    ]
  }
}
Code Block
{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 1,
    "totalTypeCount": 20,
    "resultCount": 1,
    "items": [
        {
            "id": "103"
        }
    ]
}
Expand
titleconfig : 하위에 다른 API 결과를 조합하여 응답을 생성

snack 응답결과에 snackScore 쿼리 결과를 조합하는 사례

Code Block
{
  "typeId": "api",
  "category": "snack",
  "apiId": "list",
  "apiName": "snack List",
  "apiType": "service",
  "method": "GET",
  "parameters": [
  ],
  "statistic": true,
  "aggregation": false,
  "root": {
    "configId": "root",
    "tid": "snack",
    "type": "query",
    "query": [
      {
        "method": "matching",
        "field": "name",
        "value": "{{:name}}"
      }
    ],
    "response": [
      {
        "field": "id",
        "type": "field",
        "value": ""
      },
      {
        "field": "name",
        "type": "field",
        "value": ""
      },
      {
        "field": "scoreList",
        "type": "config",
        "config": [
          {
            "tid": "snackScore",
            "type": "query",
            "query": [
              {
                "method": "sorting",
                "value": "score desc"
              },
              {
                "method": "matching",
                "field": "snack",
                "value": "{{:id}}"
              }
            ],
            "response": [
              {
                "field": "id",
                "type": "field",
                "value": ""
              },
              {
                "field": "score",
                "type": "field",
                "value": ""
              }
            ]
          }
        ]
      }
    ]
  }
}

"field": "scoreList" 에 snackScore 쿼리 결과

snackScore 쿼리에서 {{:id}} 는 상위 snack 응답결과의 id로 치환되었다.

Code Block

{
  "method": "matching",
  "field": "snack",
  "value": "{{:id}}"
}


Code Block
{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 1,
    "totalTypeCount": 20,
    "resultCount": 1,
    "items": [
        {
            "id": "101",
            "name": "꼬깔콘",
            "scoreList": [
                {
                    "id": 1,
                    "score": 5
                },
                {
                    "id": 2,
                    "score": 5
                },
                {
                    "id": 3,
                    "score": 4
                }
            ]
        }
    ]
}

type별 사용 가능한 항목

Query
Event
Select
Relay
Read
Reads
Form
Method
Process
Response
id

targetId

configId

type

tid

O

O

O

O

O

resultType

relayUrl

O

relayMethod

O

datasource

O

sql

O

method

O

process

O

cacheable

cacheTime

keepCache

excludeCacheKey

allowParams

if

connectTimeout

readTimeout

customFilter

O

customResponse

event

O

failOver

compensatingAPI

query

O

data

O

O

O

O

relayType

O

relayAuth

O

relayHeader

O

bodyType

O

relayParameters

O

relayBody

O

response

orderNo