Sendgrid says that the Categories are in the form of String data type as follows:
[
{
"email": "john.doe@sendgrid.com",
"timestamp": 1337966815,
"category": [
"newuser",
"transactional"
],
"event": "open"
},
{
"email": "jane.doe@sendgrid.com",
"timestamp": 1337966815,
"category": "olduser"
"event": "open"
}
]
So, if someone sends a numerical number , say 11111
for category, sendgrid will treat it as a string and send it back .
I always use numerical values to send and when I get the same value back, I store it in an integer column in my database. For example I will be storing
11111
value in my column category_int
and it's data type is int(11)
.
Since, I am always storing it in an integer column, whenever someone sends category in the form of actual string just like above olduser
, I get an error.
My Question:
Am I seeing error because,my category_int
column is intended to receive integer values and not string values? But if this is true then, isn't the value that sendgrid is sending , in case of numbers(in my case 11111) is
treated as string and perhaps, I should be getting error in this case as well. Where as I get errors only when I send category in the form of some descriptive words like olduser
etc.
Please advise.