Web API (official plugin)

2 anos atrás
elbatah wrote:
we purchased web apis for one project and we cannot find documentation on how to use the apis itself from business perspective

The only documentation we have is available here

elbatah wrote:
for example , we need to remove one item from Cart , we cannot find anything related or cannot change the quantity of item in carts

The plugin duplicates all methods available out of the box. So you can implement it the same way you if you were working with nopCommerce even without the web API plugin. Invoke the same methods. For example, here is thedelete method and the appropriate method in the \Nop.Plugin.Misc.WebApi.Backend\Controllers\Orders\ShoppingCartItemController.cs file
2 anos atrás
By API can i insert / update  any entityId  in Table GenericAttribute ?

SELECT [Id]
      ,[KeyGroup]
      ,[Key]
      ,[Value]
      ,[EntityId]
      ,[StoreId]
      ,[CreatedOrUpdatedDateUTC]
  FROM [dbo].[GenericAttribute]

Thanks !
2 anos atrás
Code generation tools like Visual Studio's "Add REST API Client" depend on an "operationId" attribute in the API definition json file to help create method names. Without the operationId attribute Visual Studio generates methods like "Delete23Async" and "Delete24Async" instead of something useful like "DeleteVendorAsync".
More information on this topic is available at https://devblogs.microsoft.com/aspnet/creating-discoverable-http-apis-with-asp-net-core-5-web-api/?WT.mc_id=dotnet-13135-jogallow
I have begun the tedious process of adding the operationId attribute to the Web API swagger.json files. I think it's necessary for the API to be very useful in Visual Studio development.
I'd be happy to share this work if you can point me to where I can make a pull request. I'd be even happier to find out that this has already been done by someone else. ;)

Linden
2 anos atrás
What is the best way to give feedback on the API? Is there a GitHub site? I just ran across a couple of typos that should probably be addressed.

/api-backend/OrderItem/GeByGuid and /api-backend/Order/GeByGuid should be /GetByGuid.
2 anos atrás
Elicat1 wrote:
By API can i insert / update  any entityId  in Table GenericAttribute ?

Yes
2 anos atrás
Linden wrote:
What is the best way to give feedback on the API? Is there a GitHub site? I just ran across a couple of typos that should probably be addressed

We'll fix these typos. Thanks a lot!

Please send any other suggestions using our contacts form
2 anos atrás
Hi all; we're about to integrate with nopCommerce REST API in an ongoing project, so far this works rather well and the API seems pretty well crafted but we're missing out on how to programmatically remove ShoppingCart items via /api-frontend/ calls. There seems no DELETE method or something. What's the intended way of doing so?
Thanks and best regards,
Kristian
2 anos atrás
z428 wrote:
we're missing out on how to programmatically remove ShoppingCart items via /api-frontend/ calls. There seems no DELETE method or something. What's the intended way of doing so?

You need to call the same methods that you call in a similar situation when working with nopCommerce. In this case, it is the ShoppingCartController.UpdateCart method.
2 anos atrás
DmitriyKulagin wrote:
You need to call the same methods that you call in a similar situation when working with nopCommerce. In this case, it is the ShoppingCartController.UpdateCart method.


Ok. Haven't so far been working with anything else in nopCommerce so am pretty new to that, just exploring the system through the swagger endpoints. I already tried the /api-frontend/ShoppingCart/UpdateCart call but was unsure which data structure to actually provide to make it work. The documentation in swagger just outlines an object with string properties. My naive approach was to do a GET /api-frontend/ShoppingCart/Cart , take the result of that and POST it into UpdateCart again which however, apparently doesn't work and ends in messages like

{
  "errors": {
    "": [
      "JsonToken EndArray is not valid for closing JsonType Object. Path '', line 6, position 13."
    ],
    "items": [
      "Unexpected character encountered while parsing value: [. Path 'items', line 6, position 12."
    ]
  },
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "traceId": "00-cde6385ac32dc646b08150f7502379db-7220a47b3d6ec942-00"
}

... so, what structure does UpdateCart require to achieve what I want?
Thanks in advance and best regards,
Kristian
2 anos atrás
z428 wrote:
what structure does UpdateCart require to achieve what I want?

Everything becomes more obvious if you run a similar method in the main kernel under debug. You will see what parameters are passed and, accordingly, do the same when calling the API method. This is what the structure of the passed object of the UpdateCart method looks like for removing an item from the cart.
{
  "removefromcart": "{ShoppingCartItemId}"  
}