Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use API plugin #227

Open
dewebeloper opened this issue Jul 17, 2020 · 12 comments
Open

How to use API plugin #227

dewebeloper opened this issue Jul 17, 2020 · 12 comments

Comments

@dewebeloper
Copy link

Hi
I download https://github.com/madewithfire/api-plugin-for-nopcommerce. By description that is for NOP v4.30.
According to system plugin is installed
image

But what now. I can't see any link how to enable API or to setup clients.
Did I do something wrong, or this version of https://github.com/madewithfire/api-plugin-for-nopcommerce is not compatible with NOP 4.30?

@oeloe100
Copy link

Hi,

From what I know Nop API Plugin is not ready for 4.3. The latest supported version is 4.2.

#223
The above link provides some information.

If you have the plugin installed you can go to admin page (backend). Then go to API section.

image

@dewebeloper
Copy link
Author

Thing is, it look like Api plugin is intalled, but there is no links in left side menu as on zour picture.

@MaximG1234
Copy link
Contributor

MaximG1234 commented Jul 20, 2020

@dewebeloper Not sure if you read through my breakdown in the #223 thread but there are quite a number of issues with the version provided by @madewithfire which basically make it unusable. I suggest downloading the version I have provided and linked in the same thread.

In terms of installation, you may find that you need to uninstall and reinstall the plugin if you previously had it installed on your Nop site. Lastly, you will find that only the 'Clients' tab will appear and you need to assign the role API USER to the customer credentials you want to use for the API. Again, this role may not appear until you reinstall the plugin.

@dewebeloper
Copy link
Author

Hi @MaximG1234
I install your version of API.
All what I get is
image
but even that is progress, because with previous version (madewithfire version) I didn't get anything on menu.

Any idea what is wrong here and how to get some functionality for API?

@MaximG1234
Copy link
Contributor

That is all you are supposed to get.

You should now be able to add customers to the Role 'Api User'. You can use this customer credential to now authenticate the API calls.

@dewebeloper
Copy link
Author

I see. Ok. Will try that.
Thanks

@dewebeloper
Copy link
Author

@MaximG1234
one more question. WHen I use customer credentials what is client_id and client_secret?
grant_type should be password, i gues?
What about scopes?

@mudasserhassan
Copy link

Hi @MaximG1234
I install your version of API.
All what I get is
image
but even that is progress, because with previous version (madewithfire version) I didn't get anything on menu.

Any idea what is wrong here and how to get some functionality for API?

Hi @dewebeloper

Didn't get API menu, can you please share how did you compile/build/publish plugin?

@dewebeloper
Copy link
Author

@mudasserhassan all is same as all other plugins.
You have to download plugin to Plugins folder, after that you have to install it from Configuration -> Local plugins and after that you will get new menu item as on your image.
You have to enable API and you are ready to go.
First you have to get access token from {localhost}/api/token?username={username}&password={password}
When you have access token for any API call you have to add Authorization header to request and that is perry much all.

@mudasserhassan
Copy link

Thanks @dewebeloper
Well, I did all this but API menu was not appearing. It is still not appearing but its routes are working and API endpoint are also working.
So, all those who are facing same, try this URL to access API Admin and enable API:
{localhost}/Admin/ApiAdmin/Settings
After that, assign "Api User" role to a customer, get token as @dewebeloper described above:
{localhost}/api/token?username={username}&password={password}
And follow documentation to access API endpoints.

@dewebeloper
Copy link
Author

According to @MaximG1234 that menu you are already have is all. There is no other menus.
I setup user manually trough database.

@mudasserhassan
Copy link

@dewebeloper
image

Actually, there is none. No menu at all. That is why I wrote last post even if there is no menu, routes for API are working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants