Skip to main content
2 of 3
added 9 characters in body
Ajwad Syed
  • 1.6k
  • 30
  • 63

Mangento2 Swagger sends request with index.php/rest/all in URL which is different from URL in Postman?

I have custom API in which I am retrieving customer balance as:

use Magento\CustomerBalance\Model\BalanceFactory; ........................ ........................ $model = $this->balanceFactory->create()->setCustomerId($customerId)->loadByCustomer(); $customerBalance = $model->getAmount(); 

In postman request is send as:

http://127.0.0.1/rest/V1/mymodule/request/R1

and output is correct logged in customer balance.

But when I test same API in Magento swagger UI, here the Curl appears is:

curl -X POST "http://127.0.0.1/index.php/rest/all/V1/mymodule/request/R1" -H "accept: application/json" -H "Authorization: Bearer nbvkrjkewuiu398hds"

which has extra index.php/rest/all/

and from response the customer balance is shown as 0 always.

What is the reason of different output on testing same API in Default Swagger and then in Postman ?

Any help will be highly appreciated!

Ajwad Syed
  • 1.6k
  • 30
  • 63