I want to send the raw body from the swagger I' am using the below code: So based on the below code the API should get the raw body. Even though it's a post request the data is not being set in the raw body of the API request.
/**
* @swagger
* /api/v1/index/nocache?method=checkIfPaymentIsValidForDays:
* post:
* summary: Frontend API
* description: Check If Custom Payment Link Is Valid For Given Days
* consumes:
* - application/json
* parameters:
* - in: data
* name: data
* description: The data will contain order_id and valid_for
* schema: # Request body contents
* type: object
* properties:
* order_id:
* type: string
* valid_for:
* type: integer
* responses:
* '200':
* description: Response success or failure
* content:
* application/json:
* schema:
* type: object
* properties:
* code:
* type: integer
* status:
* type: string
* msg:
* type: string
* data:
* type: object
* example:
* code: 200
* status: success
* msg: success
* data: {"isValid": true}
*/
/*=================================*/
But on the api end I am getting empty raw body as shown below:
can't parse JSON. Raw result:
<pre>
Var: Zend_Controller_Request_Http Object
(
[_paramSources:protected] => Array
(
[0] => _GET
[1] => _POST
)
[_requestUri:protected] => /apachedev/git/ice9/frontend/public/api/v1/index/nocache?method=checkIfPaymentIsValidForDays
[_baseUrl:protected] => /apachedev/git/ice9/frontend/public
[_basePath:protected] =>
[_pathInfo:protected] => /api/v1/index/nocache
[_params:protected] => Array
(
[module] => api
[controller] => v1
[action] => index
)
[_rawBody:protected] =>
[_aliases:protected] => Array
(
)
[_dispatched:protected] => 1
[_module:protected] => api
[_moduleKey:protected] => module
[_controller:protected] => v1
[_controllerKey:protected] => controller
[_action:protected] => index
[_actionKey:protected] => action
)
-File: /var/www/html/apachedev/git/ice9/frontend/application/modules/api/controllers/V1Controller.php -Line: 9763
</pre>
As you can see the _rawBody is coming empty.
Please provide any solution on this, I'm new to swagger.