SevenSpikes / api-plugin-for-nopcommerce

API plugin for nopCommerce
MIT License
285 stars 212 forks source link

How to use API plugin #227

Open dewebeloper opened 4 years ago

dewebeloper commented 4 years ago

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 commented 4 years ago

Hi,

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

https://github.com/SevenSpikes/api-plugin-for-nopcommerce/issues/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 commented 4 years ago

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

MaximG1234 commented 4 years ago

@dewebeloper Not sure if you read through my breakdown in the https://github.com/SevenSpikes/api-plugin-for-nopcommerce/issues/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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I see. Ok. Will try that. Thanks

dewebeloper commented 4 years ago

@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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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

mudasserhassan commented 3 years ago

@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.