Placewise API
Get startedExplore
Get startedExplore
Performance Cloud 🗗
Placewise 🗗
  1. Common Concepts
  • Introduction
  • Global Headers
  • Common HTTP Error Codes
  • API Permits
  • Rate Limiting
  • Authorization
    • Token Authorization
    • Member Authorization
    • User Authorization
  • API Contexts
    • Customer Context
    • LoyaltyClub Context
    • Global Context
  • Common Concepts
    • Localization
    • System URLs
    • Params Validation
    • Pagination
    • Sorting
  • Common Models
    • Common Data Formats
    • Member Model
    • API Entity Model
    • Opening Hours Model
  1. Common Concepts

Params Validation

Some of the endpoints (it's noted on specific request's description) return invalid parameters errors in the standardized way.
For them, when some of parameter (either JSON body or URL/Query) is invalid, server responds with 422 with a following
object:
keyTypeDescription
errorStringAlways "Invalid parameters"
detailsErrors objectSee Errors below
details.(path.0.to.)parameter_nameArray ParameterErrorSee ParameterError below

Example response#

// Considering that request with following payload has been sent:
{
  "member": { "first_name": "s", "msisdns": ["123", "4740769126",""] }
}

// Following response is returned: 
{
  "error": "Invalid parameters",
  "details": {
    "member": {
      "name": [
        { "error": "too_short", "options": { "min_length": 0 } },
        { "error": "invalid_format", "options": { "format": "/[A-Z][a-z]+/" } }
      ],
      "msisdns": {
        "0": [{ "error": "invalid_msisdn" }],
        "2": [{ "error": "blank" }]
      }
    }
  }
}

// It means that in given payload:
// * member.name is too short 
// * member.name has invalid format
// * member.msisdns[0] is not a valid MSISDN
// * member.msisdns[2] is blank

Errors object#

It's a recursive tree structure, corresponding to the structure original payload.
Objects being parts of arrays are represented by their array indexes.
Each leaf node is an array of ParameterError objects for given parameter.

ParameterError object#

KeyTypeOptional?Description
errorStringnoSymbol of error that relates to this parameter
optionsObjectnoContains options of specific validation rule. For example {"max": 15}.

Common validation errors#

Error keyOptionsDescription
attribute_cannot_be_present_withwith - other attribute nameMutually exclusive with another attribute
attribute_cannot_be_present_withoutwithout - other attribute name
blankWhen not present
greater_or_equal_tonumber - min valueWhen not greater than or equal to number
does_not_existWhen related record does not exist
invalidformat - regexWhen has invalid format
greater_thannumber - min valueWhen not > number
greater_than_propertyproperty - compared propertyWhen not > value of property
inclusionin - contains permitted valuesWhen doesn't match list of permitted values
invalid_car_registration_numberWhen doesn't match required car registration number format
invalid_dateWhen doesn't match date format ('YYYY:MM:DD')
invalid_hex_colorWhen doesn't match hex color format ('#000000')
invalid_hourWhen doesn't match hour format ('HH:MM')
invalid_jsonWhen isn't a valid JSON
invalid_msisdnWhen cannot be processed as a valid MSISDN>
invalid_email
invalid_iso_3166_countryWhen not valid ISO 3166-1 alpha-2 country code
invalid_iso_8601_timeWhen not valid according to ISO 8601
invalid_iso_639_1_languageWhen not valid according to ISO 639-1
less_or_equal_tonumber - max valueWhen not less than or equal to number
less_thannumber - max valueWhen not < number
less_than_propertyproperty - compared propertyWhen not > value of property
liquid_syntax_errorsyntax_error - error descriptionWhen not valid liquid syntax
must_be_a_string
must_be_a_boolean
must_be_an_array
must_be_an_urlallowed_protocols - e.g ['https']When not a valid URL
must_be_a_https_urlWhen not a valid HTTPS URL
must_be_an_array_of_objects
must_be_an_object
must_be_in_the_futureWhen date is not in the future
must_be_in_the_pastWhen date is not in the past
must_be_uniqueWhen value is not unique in some context
must_be_uuidWhen not a valid UUID
must_have_elements_of_typetype - required type
not_a_number
not_an_integer
record_does_not_existWhen related record does not exist
records_do_not_existnon_existing_idsWhen related records do not exist
size_not_matchnumber - exact sizeWhen array has not exactly required number of elements
size_too_largenumber - max sizeWhen array has too many elements
size_too_smallnumber - min sizeWhen array has not enough elements
too_shortmin - min length, count - given lengthWhen string length is too small
too_longmax - max length, count - given lengthWhen string length is too large
takenWhen another record already uses this value
unpermitted_property
Previous
System URLs
Next
Pagination
Built with