How to get parameters value in string from post url in rest api in magento 2. (I need username and password in my custom module). http://.../Magento2/index.php/rest/V1/authorize?username=Arjun&password=2. I am getting o as value and not string.

1 Answer 1


In the interface have you added docblock (/** /) This specifies what will be return type of your output and which is must? For my code I was just adding sum of two numbers so here is code of my interface as below,

interface CalculatorInterface
     * Add two numbers.
     * @param int $num1
     * @param int $num2
     * @return int
    public function add($num1, $num2);
  • Anytime :) You can upvote using up arrow if it helped you. Thanks :)
    – Rushvi
    Jul 14, 2016 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.