How to create response json block based on the API result which is in json format. Tried many ways from the doc I have seen, still get failure.
My tavern test:
status code [400]
{
"code": "VALIDATION",
"message": {
"*": [
"Incomplete data provided. Missing properties \"code\"."
]
},
"url": "/data/auth",
"result": {
"meta": [],
"data": {
"trace": [
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/JsonResponseDataParser/InternalApiJsonResponseDataParser.php",
"line": 50,
"function": "getExceptionForErrorType",
"class": "Shipwire\\ApiClient\\GenericApiErrorHandler",
"type": "::"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/GenericApiErrorHandler.php",
"line": 140,
"function": "getError",
"class": "Shipwire\\ApiClient\\JsonResponseDataParser\\InternalApiJsonResponseDataParser",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/GenericApiErrorHandler.php",
"line": 98,
"function": "_handleAll",
"class": "Shipwire\\ApiClient\\GenericApiErrorHandler",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/GenericGateway.php",
"line": 445,
"function": "process",
"class": "Shipwire\\ApiClient\\GenericApiErrorHandler",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/GenericGateway.php",
"line": 578,
"function": "setResponse",
"class": "Shipwire\\ApiClient\\GenericGateway",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/GenericGateway.php",
"line": 389,
"function": "getProcessedResponse",
"class": "Shipwire\\ApiClient\\GenericGateway",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/module/Main/src/Main/Library/Auth/Auth.php",
"line": 28,
"function": "fetch",
"class": "Shipwire\\ApiClient\\GenericGateway",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/module/Main/src/Main/Controller/AuthController.php",
"line": 47,
"function": "verify",
"class": "Main\\Library\\Auth\\Auth",
"type": "::"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/shipwire/internal-shipwire-api-client/src/Shipwire/ApiClient/AbstractController.php",
"line": 282,
"function": "getList",
"class": "Main\\Controller\\AuthController",
"type": "->"
},
{
"function": "onDispatch",
"class": "Shipwire\\ApiClient\\AbstractController",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-eventmanager/src/EventManager.php",
"line": 489,
"function": "call_user_func"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-eventmanager/src/EventManager.php",
"line": 259,
"function": "triggerListeners",
"class": "Laminas\\EventManager\\EventManager",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php",
"line": 115,
"function": "triggerEventUntil",
"class": "Laminas\\EventManager\\EventManager",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-mvc/src/Controller/AbstractRestfulController.php",
"line": 299,
"function": "dispatch",
"class": "Laminas\\Mvc\\Controller\\AbstractController",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-mvc/src/DispatchListener.php",
"line": 117,
"function": "dispatch",
"class": "Laminas\\Mvc\\Controller\\AbstractRestfulController",
"type": "->"
},
{
"function": "onDispatch",
"class": "Laminas\\Mvc\\DispatchListener",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-eventmanager/src/EventManager.php",
"line": 489,
"function": "call_user_func"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-eventmanager/src/EventManager.php",
"line": 259,
"function": "triggerListeners",
"class": "Laminas\\EventManager\\EventManager",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/vendor/laminas/laminas-mvc/src/Application.php",
"line": 339,
"function": "triggerEventUntil",
"class": "Laminas\\EventManager\\EventManager",
"type": "->"
},
{
"file": "/var/www/shipwire.www/swclient/public/index.php",
"line": 15,
"function": "run",
"class": "Laminas\\Mvc\\Application",
"type": "->"
}
]
},
"moreInformation": []
},
"state": []
}
How to create response json block based on the API result which is in json format. Tried many ways from the doc I have seen, still get failure.
My tavern test:
The response, got 200: