Versions Compared

Key

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

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

...

Expand
titleapiConfig에 allowParams = true
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",
    "allowParams" : true,
    "query": [
    ],
    "response": [
      {
        "field": "_all_",
        "type": "all"
      }
    ]
  }
}

name_matching=오레오 쿼리 검색 성공

Code Block
{{protocol}}://{{hostname}}:{{port}}/svc/snack/list?_siteId=bestshop&name_matching=오레오

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 1,
    "totalTypeCount": 18,
    "resultCount": 1,
    "items": [
        {
            "id": "103",
            "label": "오레오",
            "name": "오레오"
        }
    ]
}

Expand
titleapiConfig에 allowParams = false
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",
    "allowParams" : false,
    "query": [
    ],
    "response": [
      {
        "field": "_all_",
        "type": "all"
      }
    ]
  }
}

name_matching=오레오 쿼리 검색 실패

Code Block
{{protocol}}://{{hostname}}:{{port}}/svc/snack/list?_siteId=bestshop&name_matching=오레오

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 18,
    "totalTypeCount": 18,
    "resultCount": 18,
    "items": [
        {
            "id": "101",
            "label": "꼬깔콘",
            "name": "꼬깔콘"
        },
        {
            "id": "102",
            "label": "빠다 코코낫",
            "name": "빠다 코코낫"
        },
        {
            "id": "103",
            "label": "오레오",
            "name": "오레오"
        },
        {
            "id": "104",
            "label": "쿠크다스",
            "name": "쿠크다스"
        }

        ...
        
        
    ]
}

...

추가적인 처리가 필요한 경우 해당 서비스 정의를 해야한다.

아래는 응답결과에 idx 필드를 추가하는 사례이다.

  • Class 추가

    • location : net/ion/ice/core/context/response

    • implements CustomResponse 하는 class 를 하나 생성한다.

  • @Component 어노테이션 추가

    • @Component("sampleResponse")

  • customResponse 작성

...

Code Block
{{protocol}}://{{hostname}}:{{port}}/svc/snack/list?_siteId=bestshop&limit=2

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 20,
    "totalTypeCount": 20,
    "resultCount": 2,
    "more": true,
    "moreCount": 10,
    "items": [
        {
            "id": "104",
            "label": "쿠크다스",
            "name": "쿠크다스",
            "idx": 1
        },
        {
            "id": "103",
            "label": "오레오",
            "name": "오레오",
            "idx": 2
        }
    ]
}

...

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