Data Types
This section provides detailed information about the datatypes used in the Verifiet API. Understanding these datatypes is crucial for proper integration and data validation.
List of Datatypes
1. String
- Description: Represents a sequence of characters. Commonly used for textual data such as names, addresses, or identifiers.
- Validation Rules:
- Maximum length: 255 characters.
- Allowed characters: UTF-8 encoding.
- Example Values: "JohnDoe", "Address_123", "UUID-1234-abcd"
- Context: Used in fields like username, address, entity_id.
- Error Handling:
- Error Code: 400 - "Invalid string length" if the length exceeds 255 characters.
- Error Code: 422 - "Invalid characters in string" if non-UTF-8 characters are used.
- Best Practices: Ensure strings are properly escaped and validated on the client side before sending to the API.
2. Integer
- Description: Represents a whole number without a fractional component.
- Validation Rules:
- Range: -2,147,483,648 to 2,147,483,647 (32-bit signed integer).
- Example Values: 100, -42, 2024
- Context: Used in fields like user_id, transaction_count, status_code.
- Error Handling:
- Error Code: 400 - "Integer out of range" if the value exceeds the allowed range.
- Best Practices: Use integers for counters, identifiers, and status codes.
3. Boolean
- Description: Represents a binary value, either true or false.
- Validation Rules:
- Accepts only true or false (case-insensitive).
- Example Values: true, false
- Context: Used in fields like is_active, is_verified.
- Error Handling:
- Error Code: 400 - "Invalid boolean value" if any value other than true or false is provided.
- Best Practices: Use booleans for flags, switches, and binary state indicators.
4. Date
- Description: Represents a date value without time. Typically formatted as YYYY-MM-DD.
- Validation Rules:
- Must adhere to ISO 8601 format.
- Example Values: 2024-08-09, 1990-01-01
- Context: Used in fields like birthdate, registration_date.
- Error Handling:
- Error Code: 400 - "Invalid date format" if the date is not in YYYY-MM-DD format.
- Best Practices: Always ensure the date is in the correct format and time zone considerations are handled elsewhere if needed.
5. Float
- Description: Represents a number that can have a fractional component.
- Validation Rules:
- Supports both positive and negative values with a precision up to 6 decimal places.
- Example Values: 123.45, -9876.54321
- Context: Used in fields like transaction_amount, exchange_rate.
- Error Handling:
- Error Code: 400 - "Invalid float value" if the value has more than 6 decimal places or is not a valid number.
- Best Practices: Use floats for monetary values or ratios, and ensure precision is consistent across the application.
Versioning
Verifiet API datatypes are versioned along with the API. Changes to datatypes or their validation rules will be noted in version release notes.
Best Practices
- Always validate data on the client side before sending it to the API.
- Handle API responses gracefully, especially in case of datatype-related errors.
- Stay updated with API version changes to ensure compatibility.
Conclusion
Understanding and correctly utilizing Verifiet's datatypes is essential for a smooth API integration. If you have any questions or require further clarification, please refer to the full API documentation or contact support.