Date, Time, Numbers

Date and Time Requirements

Dates:

When interacting with the API, it's important to note that dates have specific formatting requirements. For GET requests, dates are returned as arrays, such as [2007, 4, 11]. However, when sending POST or PUT requests, the API expects dates to be provided as strings. Additionally, the API operates in the US Eastern Standard Timezone.

To properly format dates in POST or PUT requests, you need to include the "locale" and "dateFormat" parameters. The "locale" should be set to "en_US" to indicate the desired US English formatting. The "dateFormat" parameter should follow a date pattern supported by the Java time from JDK. This simplifies the process of saving data in your client application, as you don't need to perform any additional date format conversions before sending the POST or PUT request.

Here are examples of properly formatted JSON for different date patterns:

JSON Example 1:

{
  "locale": "en_US",
  "dateFormat": "dd MMMM yyyy",
  "openingDate": "01 July 2007"
}

JSON Example 2:

{
  "locale": "en_US",
  "dateFormat": "yyyy-MM-dd",
  "openingDate": "2007-03-21"
}

Time

In the MBanq Cloud API, timestamps are represented in the Eastern Standard Time (EST) timezone. The recommended format for timestamps in the API response is "YYYY-MM-DD HH:mm:ss" (e.g., "2023-02-08 15:27:07").

This format provides the date and time in a clear and standardized manner. The timestamp includes the year, month, day, hour, minute, and second, separated by dashes and colons. It follows a 24-hour clock format.

Using this format ensures consistency and allows developers to easily interpret and manipulate timestamps across different systems and timezones.

{
  "id": 40,
  "userId": 15,
  "username": "jack",
  "firstname": "Jack",
  "lastname": "Grealish",
  "timestamp": "2023-02-08 15:27:07",
  "success": false,
  "type": "LOGIN",
  "ipAddress": "127.0.0.1",
  "deviceDetail": "insomnia/2022.6.0"
}

Numbers:

When updating numeric values, such as money amounts or percentages related to loans, it's crucial to include the "locale" parameter. Numbers should be treated as numeric values and not as identifiers or types. Forgetting to include the "locale" parameter will result in an error message from the API.

Here are examples of properly formatted JSON for numbers:

JSON Example 1:

{
  "locale": "en_US",
  "principal": "240,400.88"
}

JSON Example 2:

{
  "locale": "fr_CH",
  "principal": "240 400.88"
}

By adhering to these specified requirements for dates and numbers, you can ensure seamless communication with the API and avoid any potential errors or inconsistencies in your requests. It's important to note that all dates and numbers should be formatted according to the US Eastern Standard Timezone.