You might have seen many post related to this title. But, I think, I have a different case where I need help. I tried to go thru several threads for my question but could not find any specific answer that I can go with confidence.
To explain, I want to publish a RESTful API that performs typical GET operation based on provided input details. This API is idempotent in nature and does not create, update or delete any resource. So, my ideal choice should be to use HTTP GET method in this case.
However, making things complex, my API will need a big JSON object with details as a part of the request to derive required information for the response. It is not advisable to put that JSON string in the request URI. Hence, I have to put that in request body itself. But, HTTP GET does not consider request body content. And, I don't want to (or don't know if I should) use HTTP POST or PUT for this API as the API is idempotent and does not create/modify any resource.
For now, I am more inclined towards using HTTP OPTIONS for this purpose, but I am not sure if this is something I should do considering RESTful standardization.
So, what do you suggest? Is it an acceptable usecase to use POST or OPTIONS in this case? Or, I should do something else?
For reference, below is the dummy sample of the request data object.
{
"parametersList": {
"itemRange": {
"code": "11",
"start": 100683,
"end": 168003
},
"dateRange": {
"startDate": "2017-10-01",
"endDate": "2017-10-31"
},
"market": {....},
"startTimeRange": {...},
"endTimeRange": {....},
"serviceType": {....},
"segmentType": {....},
"daysOfWeek": {
"days": ["MON", "WED", "THU", "FRI", "SAT", "SUN"]
},
"itemNumber": 0
}
}
The {...}
in above example represents internal object structure that may vary based on the data.