2017-06-02 75 views
0

我使用API​​來檢查憑證代碼是否存在。如果優惠券代碼存在,一切都很好,但問題是,當我輸入錯誤代碼,然後我得到這個:使用404和來自API的響應

Client error: `GET https://apidev.example.co.uk/api/v1/vouchers/2869512_1-9FDS` resulted in a `404 Not Found` response: 
{ 
"Code": 1000, 
"Description": "Voucher no. is unknown please check and try again or contact Acorne on 0330 111 04 (truncated...) 

我有這樣的代碼在後端(laravel PHP):

$res = json_decode($res->getBody()->getContents(), true); 
dd($res); 

如何我可以訪問代碼1000,並刪除此錯誤屏幕?

更新: 當憑證有效和dd($ res)時屏幕; enter image description here

+0

分享的'DD($ RES)的結果;' – Sandeesh

+0

如何處理錯誤消息? –

+0

當有優惠券時,我使用dd($ res)圖像更新問題 –

回答