Can anyone let me know how to return success message with object like this same as magento does for the exception in REST webapi:

    "message": "A customer with the same email already exists in an associated website."

Above is the example of exception message, same i want to do with success response, i tried with array but it returns an array with an object like this:

        "message": "this is test"

I don't want array but only object returns inside it.I have used following code for it:

$msg[] = array("message"=>"this is test");
return $msg;    
  • 1
    @return string[] pass this in Interface function – Aditya Shah Sep 12 '18 at 6:28
  • I have used @return string[] in interface but it still returns object with array, i only needs object like this: { "message": "test msg" } not [ { "message": "test msg" } ] – bhargav shastri Sep 12 '18 at 7:50
  • @Amit, did you check? – bhargav shastri Sep 13 '18 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.