2017-11-05 6 views
0

는이 같은 하나의 간단한 모델 루프백 API가 :루프백 3.0 : 필터의 REST API에서 결과를 반환하지 않는 경우

{ 
    "name": "Establishment", 
    "base": "PersistedModel", 
    "idInjection": true, 
    "options": { 
    "validateUpsert": true 
    }, 
    "properties": { 
    "Distance": { 
     "type": "number" 
    }, 
    "EstablishmentId": { 
     "type": "number" 
    }, 
    "EstablishmentType": { 
     "type": "string" 
    }, 
    "Location": { 
     "type": "string" 
    }, 
    "MinCost": { 
     "type": "number" 
    }, 
    "Name": { 
     "type": "string" 
    }, 
    "Stars": { 
     "type": "number" 
    }, 
    "UserRating": { 
     "type": "number" 
    }, 
    "UserRatingTitle": { 
     "type": "string" 
    }, 
    "UserRatingCount": { 
     "type": "number" 
    }, 
    "ImageUrl": { 
     "type": "string" 
    }, 
    "ThumbnailUrl": { 
     "type": "string" 
    } 
    }, 
    "validations": [], 
    "relations": {}, 
    "acls": [], 
    "methods": {} 
} 

간단한 전화 http://localhost:3000/api/Establishments로 돌아갑니다 모든 결과, 예상대로를; http://localhost:3000/api/Establishments?filter[where][distance][gt]=30을 호출하면 결과가 전혀 나오지 않습니다. 빈 배열입니다.

Establishment s가 많이 있고 Distance이 30보다 큽니다. 실제로 다른 속성에서 where 필터를 사용하면 빈 배열이됩니다. 나는 무엇을 놓칠 수 있 었는가?

+0

어쩌면 그 대소 문자를 구분 시도는 첫 글자를 소문자하거나 사용하는 모델에 필드 이름을 변경하기 때문에 "거리 "귀하의 필터 –

답변

0

내가 주석에서 언급했듯이, 대소 문자를 구별하고 나는 그것에 대해 확신하기 위해 내 애플 리케이션에 그것을 varified.

http://localhost:3000/api/Establishments?filter[where][Distance][gt]=30 

또는이 형식 시도 할 수 있습니다 :

이 있어야한다

http://localhost:3000/api/Establishments?filter={"where":{"Distance":{"gt":30}}} 
+0

나는 그 URL의 대소 문자를 구분하지 않습니다. 어느 경우 에나 첫 번째 제안은 효과가 없으며 두 번째 제안은 거리가 30보다 작은 식당을 반환합니다. – serlingpa

+0

@serlingpa이 범위를 시설에 추가하십시오 .json' "scope": { "where : { "거리": { "gt": 30} } }'이것을 http : // localhost : 3000/api/Establishments라고 부르면 같은 결과가됩니까? –