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?

Prince Patel
23.1k10 gold badges102 silver badges124 bronze badges
asked Jan 2, 2018 at 4:42

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/

answered Jan 2, 2018 at 4:51
5
  • Thanks...You are correct. But now I'm getting 'Consumer is not authorized to access %resources' error 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. 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!!

answered Sep 19, 2022 at 10:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.