Greetings humans!
I've started to develop a vue frontend against the new DW API (wohoooo!) for our webshop
and ran into a bit of a problem with the products & product endpoints.
When using the endpoint "/dwapi/ecommerce/products" with a specified GROUPID i get this error
"The offset specified in a OFFSET clause may not be negative.".
Here is the Request URL
"http://advaniavefverslun.local.dynamicweb.dk/dwapi/ecommerce/products?GroupId=GROUP210"
Here is the full stack trace:
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)\r\n at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)\r\n at System.Data.SqlClient.SqlDataReader.Read()\r\n at Dynamicweb.Ecommerce.Products.ProductRepository.GetPagedProductsWithCount(IEnumerable`1& products, String groupIds, String searchValue, String languageId, String orderBy, String orderByDirection, Int32 pageSize, Int32 pageNumber, Boolean searchInAllFields, Nullable`1 shopType, Boolean includeOrphanedProducts)\r\n at Dynamicweb.Ecommerce.ProductCatalog.ViewModelFactory.CreateView(ProductListViewModelSettings settings, String groupId)\r\n at Dynamicweb.Ecommerce.WebAPI.Controllers.ProductsController.GetAll(SearchRequest search, ProductListViewModelSettings request)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker. d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult. d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher. d__1.MoveNext()"
After looking around we found this code under Dynamicweb.Ecommerce.Products.ProductRepository.GetPagedProductsWithCount()
Could the be a possible culprit? Maybe the pageNumber being zero or something along those lines?
I then decided to move on and try out the "/dwapi/Product/GetProductGroupList" endpoint. I got the following result
So I decided to try out the sample API provided by DW (https://doc.dynamicweb.com/dwapi/docs/index.html?url=/dwapi/api.json&layout=BaseLayout) but it seems like it has no products set up.
Do you have a sample webshop set up with products I could test against to see if it's my project/db that is causing the issue or if this is an issue with the new API?
Kind Regards,
Snævar