SOLVED

Re: REST API - Filetring not working as expected for invalid data types.

Go to solution
DavidK
Level 2

REST API - Filetring not working as expected for invalid data types.

We noticed that there are cases when invalid values are passed to filters but those are not validated. 
Example:
- In case of this call: https://190-yef-239.mktorest.com/rest/v1/opportunities/roles.json?filterValues=test12&filterType=lea... an error is thrown by the API stating: "Invalid value for field 'leadId' and value 'test12'.
- In case of this call: https://190-yef-239.mktorest.com/rest/v1/namedaccounts.json?filterValues=test123%2C1&filterType=appr... 
no error is thrown and results are returned from the API. All the returned results contain approximateNumOfPeople=0 so I assume a default value is being picked up.

Other than not throwin an error, this is returning invalid results.
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: REST API - Filetring not working as expected for invalid data types.

You shouldn’t rely on server-side datatype validation; it’s merely a convenience that certain core fields are validated. Instead, download the schema and validate locally.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: REST API - Filetring not working as expected for invalid data types.

You shouldn’t rely on server-side datatype validation; it’s merely a convenience that certain core fields are validated. Instead, download the schema and validate locally.