Use the define action to retrieve the field definitions. Each action will have a list of acceptable fields.
Here are the properties that may be included with each field:
- name - the name of the field -- used when referring to the field
- friendlyname - human friendly name for the field
- type - the data type (see data types below for additional information)
- lengthMax - the maximum string length for values
- lengthMin - the minimum string length for values
- values - the values field property will be either:
- a string of the API object that contains the valid values (e.g., countries), or
- an array of acceptable values
- default - the value that will be automatically used if the field is not included
- properties - an array of additional field properties including:
- required - a value must be provided for this field
- valueRequiredOnEdit - a value is required for this field if you include it when editing the object
- arrayAllowed - the field will accept an array of values
- modules - the RescueGroups.org service module(s) required to use the field
- permissions - the RescueGroups.org user permission(s) required to use the field
The RescueGroups.org HTTP API uses several different data types. Be sure to use the define action to determine the data type for each object field. If the value you provide does not match the expected data type and format, you will receive a validation error.
- date - a date string in the format MM/DD/YYYY
- datetime - a date and time string in the format MM/DD/YYYY hh:mm:ss
- email - an email address in firstname.lastname@example.org format
- float - a number with precision to two decimal places (typically used for money fields)
- int - a whole number
- key - an value that uniquely represents an object record -- acceptable values can be retrieved from the values list provided with the field
- phone - a ten digit phone number (will be reformatted to (NNN) NNN-NNNN)
- string - a combination of letters, numbers, special characters and white space.
- postalcode - a 5 digit US zip code (NNNNN) or a 6 character Canadian postal code (CNC NCN)
- url - a website URL that starts with http:// or https://
Important things to note:
- A string field with a list of values will not have length requirements because only the values from the list will be allowed.
Required fields and defaults
The add action may require that certain fields be provided with a value. If the field also has a default value, you are not required to provide the value with your add() request, and the default value will be used.
If a field has the property "valueRequiredOnEdit," the field is not required to be included in your data, but if you do include the field, a value is required.