Web API (official plugin)

1 year ago
Most likely you are right and the documentation needs to be updated, but all our code is completely open and you can easily find an example of how it is implemented in 4.60.

But you went too deep, you don't need to redefine services, it will be enough to implement the IConsumer<OrderPlacedEvent> interface. In this case, you do not need to register anything, the main thing is that your class be public

General Peaceful wrote:

Hi Sergei,
I am trying to do exactly this, but the documentation is seriously lacking in some areas. Using this "send order to external API" question as an example, my understanding is that it would require creating an override for the "PlaceOrderAsync()" function. The documentation for creating an override says to use a "DependencyRegistrar", which would extend "IDependencyRegistrar" from the "Nop.Core.Infrastructure.DependencyManagement" file.
This file does not exist in the 4.60+ source code.
Please can this be added, and/or the documentation updated with accurate instructions?
1 year ago
Sergei-k wrote:
Most likely you are right and the documentation needs to be updated, but all our code is completely open and you can easily find an example of how it is implemented in 4.60.

But you went too deep, you don't need to redefine services, it will be enough to implement the IConsumer<OrderPlacedEvent> interface. In this case, you do not need to register anything, the main thing is that your class be public


Ahah, I see. The DependencyRegistrar thing is just a red herring, the solution is to create a CustomOrderProcessingService that extends the original OrderProcessingService, and write my override in the custom version. Thanks for the info!
1 year ago
Hello, I purchased the Nop Web API plugin and am getting a 403 error when calling methods. It seems to work fine in developer mode so I assume it is some sort of authentication issue.

I have 2 different domains that point to my store & my license is for one of the domains. Does the plugin validate the license for the domain? If so, how do I configure the store/plugin to use the licensed domain for authentication?

thanks in advance,
Robert
1 year ago
Hi Robert.

Since the plugin was purchased for one domain, you can use it only for that domain. If you have a multistore set up, you can restrict the use of the plugin in the settings (see the description of the Limited to stores field)

As for the 403 error, I need a little more detail, please describe exactly how you are doing the requests. Are you following this guide?

rthutchison wrote:
Hello, I purchased the Nop Web API plugin and am getting a 403 error when calling methods. It seems to work fine in developer mode so I assume it is some sort of authentication issue.

I have 2 different domains that point to my store & my license is for one of the domains. Does the plugin validate the license for the domain? If so, how do I configure the store/plugin to use the licensed domain for authentication?

thanks in advance,
Robert
1 year ago
Thanks Sergei, I was able to fix the issue. It seems some permission records were missing from the permission tables so I uninstalled and re-installed and appears to work now.

thanks,
Robert
9 months ago
Hi all,

I am trying to set up the API plugin we purchased and I have the following questions:

In the folder structure I received I have 3 zip files:
WebApi.Backend
WebApi.Frontend
Nop.Plugin.Misc.WebApi.Framework

When I do the following:
1. Go to admin section
2. Upload zip folder of front end/back end spi zip folder
3. Reload project and start it again
4. Install plugin
5. Reload and restart the app

- I don`t see the plugin as part of my file structure although it appears as installed in the admin section and I want to be able to make code changes.
- No changes are detected from GIT
- A new item in my solution explorer appears called 'External Sources' with many classes and auto-generated code but none of those items are detected as changes from GIT

Note:
- I am using the default .gitignore file that comes with the project skeleton and has not made any changes
- I am using the last version of NopCommerce
- The API Plugin was purchased a couple of weeks ago

Additional questions:
- Where should the project Nop.Plugin.Misc.WebApi.Framework be added? No information for that is provided.
- Can I add manually the front-end and the back-end web API plugins?
If yes, please give me some instructions.
- Is there any information about the API plugins outside of this page: https://docs.nopcommerce.com/en/developer/web-api/index.html

Thanks in advance.

Kind regards,
Yoanna
9 months ago
If I understand your situation correctly, then you want to make changes to plugins and be able to update them through your repository. In this case, you need to unzip the three source directories (Nop.Plugin.Misc.WebApi.Framework, Nop.Plugin.Misc.WebApi.Backend and Nop.Plugin.Misc.WebApi.Frontend) directly into your structure, usually this src\Plugins folder. After that, in your development editor, connect these projects to your solution

yoanna.kostova wrote:
Hi all,

I am trying to set up the API plugin we purchased and I have the following questions:

In the folder structure I received I have 3 zip files:
WebApi.Backend
WebApi.Frontend
Nop.Plugin.Misc.WebApi.Framework

When I do the following:
1. Go to admin section
2. Upload zip folder of front end/back end spi zip folder
3. Reload project and start it again
4. Install plugin
5. Reload and restart the app

- I don`t see the plugin as part of my file structure although it appears as installed in the admin section and I want to be able to make code changes.
- No changes are detected from GIT
- A new item in my solution explorer appears called 'External Sources' with many classes and auto-generated code but none of those items are detected as changes from GIT

Note:
- I am using the default .gitignore file that comes with the project skeleton and has not made any changes
- I am using the last version of NopCommerce
- The API Plugin was purchased a couple of weeks ago

Additional questions:
- Where should the project Nop.Plugin.Misc.WebApi.Framework be added? No information for that is provided.
- Can I add manually the front-end and the back-end web API plugins?
If yes, please give me some instructions.
- Is there any information about the API plugins outside of this page: https://docs.nopcommerce.com/en/developer/web-api/index.html

Thanks in advance.

Kind regards,
Yoanna
2 months ago
Api:  POST /api-frontend/ShoppingCart/AddProductToCartFromDetails/47?shoppingCartType=ShoppingCart
Params
{
  "Color" : "apricot"
}
Expected behavior: add a product with id 47 of attribute apricot color to shopping cart
Problem: server responds with error: “Please select color”
Question: how to add a product with required color squares attribute? What should be put inside the request body for the api to work properly?
2 months ago
Api: POST api-frontend/ShoppingCart/UpdateCart
Expected behavior: edit the quantities of product in shopping cart or remove the item entirely
Problem: server responds with "message": "The given key 'itemquantity39' was not present in the dictionary."
Question: I cannot find any docs listing all the required keys in the request body. Could you provide a request example on how to use this api?
2 months ago
Hi. I'm very sorry, but not everything is so simple, our WebApi is designed as a wrapper over the basic functionality, so the dictionary parameters should have the same names as the main form of the site page uses. That is, in your case the request body should look like:


{
  "product_attribute_10" : "25"
}

where 10 is the ID of ProductAttributeMapping and 25 is the ID of ProductAttributeValue

eschur wrote:
Api:  POST /api-frontend/ShoppingCart/AddProductToCartFromDetails/47?shoppingCartType=ShoppingCart
Params
{
  "Color" : "apricot"
}
Expected behavior: add a product with id 47 of attribute apricot color to shopping cart
Problem: server responds with error: “Please select color”
Question: how to add a product with required color squares attribute? What should be put inside the request body for the api to work properly?