2

I have to work with rest APIs in magento2. For that, I added Integration through backend system->Extensions->Integration and activated the same.

Then I tried to get a response of default API of

http://local.magento.com/V1/customers/1/billingAddres

But it gives 404 error always. Is anything I'm missing to set. I also added a new user and assigned a new role with all permissions How can I activate the rest API?

2 Answers 2

8

You have issue with your api url :

Your API URL should be like this - http://local.magento.com/index.php/rest/V1/customers/1/billingAddres

Where you must need to add index.php/rest before the api parameters.

index.php is optional BUT rest parameter is required in your url.

Fore more details refer this link - Magento 2 REST API usage with examples

Also for other parameters details refer this link - http://devdocs.magento.com/swagger/

5
  • Thanks...You are correct. But now I'm getting 'Consumer is not authorized to access %resources' error
    – SIBHI S
    Commented Jan 2, 2018 at 5:12
  • @SIBHIS - Yes because you need to pass Accesstoken with your url - something like Bearer youraccesstoken , then and then it will works Commented Jan 2, 2018 at 5:13
  • As i said follow this url - magento.stackexchange.com/questions/170921/… Commented Jan 2, 2018 at 5:15
  • Thanks a lot...it works. But index.php is not necessary in my case.
    – SIBHI S
    Commented Jan 2, 2018 at 5:20
  • @SIBHIS - Yes as i have written above index.php is optional , but rest is must parameter... Happy to help - Keep helping :) Commented Jan 2, 2018 at 5:25
0

Yes, I was facing the same issue on the dev server and I just add the index.php before /rest/v1 and the issue get resolved.

Thank you!!

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.