vbandaru
5 years agoContributor
How Can we get messages using date range using POST method.
Here is an example that i am looking, but i am not able to use the below code as i am getting Json error at conversation.last_post_time because of hyphen '-' used in the value. If conversation.last_post_time value included in "202007-12T04:06:53-07:00" I am getting API error which i have specified below.
Code:
"messages": {
"fields":[
"id",
"subject",
"topic"
],
"constraints": [
{"board.id": ""},
{"depth": 0},
{"conversation.last_post_time": { ">" : 202007-12T04:06:53-07:00 }},
{"conversation.last_post_time": { "<" : 202007-13T04:06:53-07:00 }}
],
"sorts":[
"conversation.last_post_time"
],
"limit": 10
}
Error:
{
"status": "error",
"message": "Unable to parse the required Content-Body from the request.",
"data": {
"type": "error_data",
"code": 308,
"developer_message": "Unexpected character ('-' (code 45)): was expecting comma to separate Object entries",
"more_info": ""
},
"metadata": {}
}
Code:
"messages": {
"fields":[
"id",
"subject",
"topic"
],
"constraints": [
{"board.id": ""},
{"depth": 0},
{"conversation.last_post_time": { ">" : "202007-12T04:06:53-07:00" }},
{"conversation.last_post_time": { "<" : "202007-13T04:06:53-07:00" }}
],
"sorts":[
"conversation.last_post_time"
],
"limit": 10
}
API Error:
{
"status": "error",
"message": "Validation exception for conversation.last_post_time in WHERE clause: conversation.last_post_time > 202007-12T04:06:53-07:00",
"data": {
"type": "error_data",
"code": 604,
"developer_message": "Call not supported: problem with constraint. Check the type of the value or the operator",
"more_info": ""
},
"metadata": {}
}
Thanks in Advance