diff --git a/obp-api/src/main/scala/code/api/v7_0_0/Http4s700Customers.scala b/obp-api/src/main/scala/code/api/v7_0_0/Http4s700Customers.scala index 7577c9ea2f..8a995665e6 100644 --- a/obp-api/src/main/scala/code/api/v7_0_0/Http4s700Customers.scala +++ b/obp-api/src/main/scala/code/api/v7_0_0/Http4s700Customers.scala @@ -153,6 +153,11 @@ object Http4s700Customers { |sort_by, and names starting with obp_ or _. Apart from limit, offset and sort_direction (lower case) |they are accepted and ignored, as in v6.0.0. | + |Every other query parameter is an attribute filter, so a misspelt name is not refused: it filters by an + |attribute of that name. For example, `?limt=10` asks for the Customers with an attribute `limt` whose + |value is `10`. That usually matches no Customer, and the answer is an empty list, not an error. Check + |the spelling of limit, offset and sort_direction when a call returns no Customers. + | |A single value of a parameter whose name ends in currency or currency_code that looks like a currency |code is upper-cased by OBP-API before it is matched, as on every endpoint; comma-separated values are |matched as given. diff --git a/obp-api/src/test/scala/code/api/v7_0_0/CustomersAtOneBankV700Test.scala b/obp-api/src/test/scala/code/api/v7_0_0/CustomersAtOneBankV700Test.scala index 98527c51ce..6e79df564f 100644 --- a/obp-api/src/test/scala/code/api/v7_0_0/CustomersAtOneBankV700Test.scala +++ b/obp-api/src/test/scala/code/api/v7_0_0/CustomersAtOneBankV700Test.scala @@ -114,6 +114,15 @@ class CustomersAtOneBankV700Test extends V600ServerSetup { "sort_by" -> "name", "obp_limit" -> "10", "_" -> "123") should equal(List(matching)) } + scenario("A misspelt parameter name is taken for an attribute name, so it matches no Customer instead of failing", CustomersAtOneBank, VersionOfApi) { + val tag = generateUUID().take(6) + val matching = customer("organisation_kind" -> s"bank-$tag") + ids("organisation_kind" -> s"bank-$tag") should equal(List(matching)) + // limt is not limit: it is a filter on an attribute named limt, which no Customer has. + ids("organisation_kind" -> s"bank-$tag", "limt" -> "10") should equal(Nil) + ids("limt" -> "10") should equal(Nil) + } + scenario("sort_direction orders the matching Customers by customer_id, DESC by default, and pages follow that order", CustomersAtOneBank, VersionOfApi) { val tag = generateUUID().take(6) val created = (1 to 3).map(_ => customer("cohort" -> s"s-$tag")).toList.sorted