An issue with IN_UnitOfMeasureQuery  Topic is solved

Discussions relating to the REST API of Jiwa 7.

An issue with IN_UnitOfMeasureQuery

Postby gkov3 » Thu Sep 21, 2017 5:21 pm

Hi Mike,

I am trying to use auto generated IN_UnitOfMeasureQuery query to find a particular a particular PartNumber based on one of the packaging/UoM barcode, but the server is returning "Bad Request" with a message {"Index (zero based) must be greater than or equal to zero and less than the size of the argument list."}

Other queries are working fine e.g. IN_MainQuery and IN_CategoriesQuery.

Is this query available for use?

Sample code:
Code: Select all
client.Get( new IN_UnitOfMeasureQuery()
                                 {
                                     Barcode = "9987",
                                     Fields = "PartNo"
                                 }
                             ).Results.Select(t => t.PartNo).


Jiwa 7.0.187 (Self hosted REST API)

Regards,

Goran
gkov3
Occasional Contributor
Occasional Contributor
 
Posts: 13
Joined: Tue Nov 11, 2014 4:10 pm
Location: Melbourne, VIC
Topics Solved: 1

Re: An issue with IN_UnitOfMeasureQuery

Postby Scott.Pearce » Thu Sep 21, 2017 5:48 pm

You need to add the route to the REST API plugin in Jiwa.

We don't add routes for every table/view/stored procedure in the database as SwaggerUI (v2) performance sucked with so many routes (SwaggerUI v3 may be better - we are waiting for a build of ServiceStack that includes this version). We add only what we feel are going to be the commonly used routes.

Here is what you need to add to the REST API plugin under the region Configuration->Routes->Queries - AutoQueries for Tables and Views in JiwaFinancials.Jiwa.JiwaServiceModel.Tables:

Code: Select all
AppHost.Routes.Add(typeof(IN_UnitOfMeasureQuery), "/Queries/IN_UnitOfMeasure", "GET", "Retrieves a list of units of measure.", "");


Remember that when a database is upgraded, standard plugins may be overwritten. If you are going to modify a standard plugin such as the shipped REST API plugin, make a copy of it, change the Author and/or Name, and edit that version.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: An issue with IN_UnitOfMeasureQuery  Topic is solved

Postby Mike.Sheen » Thu Sep 21, 2017 6:30 pm

Scott.Pearce wrote:Remember that when a database is upgraded, standard plugins may be overwritten. If you are going to modify a standard plugin such as the shipped REST API plugin, make a copy of it, change the Author and/or Name, and edit that version.


You can actually just create a new plugin to add routes, instead of editing our standard one (or copying our standard one and editing that) - that way you don't need to concern yourself with trying to merge changes into a copied version later on when we update our standard one.

In a new plugin, the only code you'd need to add an additional route for an existing table or view is as follows:
Code: Select all
using JiwaFinancials.Jiwa.JiwaServiceModel.Tables;

namespace JiwaFinancials.Jiwa.JiwaServiceModel
{
   public class RESTAPIPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
   {
      public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost  AppHost, Funq.Container Container, JiwaApplication.Manager JiwaApplicationManager)
      {
           AppHost.Routes.Add(typeof(IN_UnitOfMeasureQuery), "/Queries/IN_UnitOfMeasure", "GET", "Retrieves a list of units of measure.", "");
      }
   }
}


PS: And as Scott mentioned Swagger UI v2.2.10 which we ship with had an issue with so many routes when we had one for each table and view - but Swagger UI 3 seems to handle it much better - we're just needing the ServiceStack Swagger UI plugin to be updated - so in the future you may not need to use a Jiwa plugin to add routes for existing tables and views.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: An issue with IN_UnitOfMeasureQuery

Postby gkov3 » Thu Sep 21, 2017 6:57 pm

Thank you guys. I think I understand now, what's going on.

Regards,

Goran
gkov3
Occasional Contributor
Occasional Contributor
 
Posts: 13
Joined: Tue Nov 11, 2014 4:10 pm
Location: Melbourne, VIC
Topics Solved: 1


Return to REST API

Who is online

Users browsing this forum: No registered users and 3 guests

cron