REST and Dates Type

1–2 minutes

To read

Database field types like numbers or dates are no longer relevant for REST services. This is because REST transmission are often in text format. Thus, you will need to consider your database design while handling REST. Should you choose a date type or retain string format for REST?

Selecting the Field Type

The key factor to select the field type is how your applications will consume the information. By default, setting data for REST endpoints in string is fast and simple. Applications often use these like staging table. Thus, your initial design should often default the data types to string for easier processing. This also allows you to consume the data without worrying about the data format. However, there are scenarios where your applications will require a specific field type to utilise feature like date and calendar.

Field Type as Data Integrity

The issue with setting string type will mean you can consume all kinds of junk data. This could be costly if you do not enable any source system do not enforce any field definition checks. Thus, field type helps to determine what type of data you will be expecting. This helps to reduce and reject data that do not conform to your field type. As this is stricter, you will required mapping checks between source and target systems of the REST endpoints.

Many applications are new to REST and the usage of field types. Such example are dates where the you may debate to use date type of retain it as string. The selection you must take will depends on your applications or the efficiency of the REST endpoints.

2 responses

  1. REST in Peace – Danny Kwok Avatar

    […] are challenges to take note while using it. This is because we are used to field types such as date. There are also things to take note while handling the different REST methods like GET or […]

    Like

  2. APEX REST Enabled Interactive Grid – Danny Kwok Avatar

    […] JSON have no data types formatting during http transmission. Thus, you need to format and validate your data before you […]

    Like

Leave a reply to REST in Peace – Danny Kwok Cancel reply

Ama Ndlovu explores the connections of culture, ecology, and imagination.

Her work combines ancestral knowledge with visions of the planetary future, examining how Black perspectives can transform how we see our world and what lies ahead.