inventory item list check  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

inventory item list check

Postby JuiceyBrucey » Sat Feb 18, 2023 3:51 pm

Hi, I am integrating JIWA into a custom shopping system and need to run a query on a list of inventory items all in one query and find out the status of each item so the system can alert the shopper that the item is not available. I need to be able to specify the products concerned.
Is there a plugin for this?
Thank you.
Cheers
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: inventory item list check

Postby DannyC » Mon Feb 20, 2023 8:03 am

Assuming you're using the REST API, sounds like you'll need a custom route.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: inventory item list check  Topic is solved

Postby Scott.Pearce » Mon Feb 20, 2023 8:55 am

You could use an AutoQuery like:

https://api.jiwa.com.au/Queries/IN_Main ... tNo,Status

Status
-------
<blank>, 0, <no status tag returned> = Active
1 = Discontinued
2 = Deleted
3 = Slow
3 = Obsolete

Don't forget to authenticate first:

https://api.jiwa.com.au/auth?username=a ... d=password

To design your own AutoQueries go to:

https://api.jiwa.com.au/ss_admin/autoquery/

and search for IN_MainQuery using the filter on the left (give it a few seconds to load - there are a lot of tables).
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: inventory item list check

Postby Mike.Sheen » Mon Feb 20, 2023 10:53 am

Scott.Pearce wrote:You could use an AutoQuery like:

https://api.jiwa.com.au/Queries/IN_Main ... tNo,Status


/Queries/InventoryItemList has more than just the main table - joins in classification, categories and even stock level - so might be a better fit... it all depends.

If you don't know about AutoQuery conventions, then you should look at the official docs, but to give you the one minute summary:

  • Provides a route per table or view
  • Provides pagination via skip, take and orderby, orderbydesc parameters
  • All fields are filterable via simple conventions - eg: ?NameStartsWith=Mi will filter the column Name, returning only those starting with the letters 'Mi', NameContainsWith=Mi will return only those containing the letters 'Mi'.
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: inventory item list check

Postby SBarnes » Tue Feb 21, 2023 7:48 am

There is also the option of being notified as to when a product gets updated using web hooks, the documentation to this can be found here

As for the auto query be aware that each call by default will only give you 100 result so you need to tell the api to include the total results via Include="Total" and then use skip in each call and once you work out the fields you want you can specify the fields as a comma separated list as in Fields=
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: inventory item list check

Postby JuiceyBrucey » Sat Feb 25, 2023 9:06 am

Thank you very much for all of these replies.
I am working my way through it now and will let you know how I go.
Thanks again.
Cheers
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: inventory item list check

Postby JuiceyBrucey » Sat Feb 25, 2023 4:44 pm

Hi Scott, thank you for this solution.
I tried it out but did not have any success. It looks like the simplest solution for what I am trying to achieve, but I only had limited luck with it. If I could get it to work, it would be the perfect solution.
I tried it using the URL directly to the local server with just one InventoryID and that worked. It returned one item. Although it did not return the Status field.
http://localhost:8020/Queries/IN_Main?I ... tNo,Status

But when I added two more InventoryIDs, I got nothing.
http://localhost:8020/Queries/IN_Main?I ... tNo,Status

I then called both of these URLS using CURL and again it worked with one InventoryID, but got nothing when I put more than one.
Any ideas?
Thank you.


Scott.Pearce wrote:You could use an AutoQuery like:

https://api.jiwa.com.au/Queries/IN_Main ... tNo,Status

Status
-------
<blank>, 0, <no status tag returned> = Active
1 = Discontinued
2 = Deleted
3 = Slow
3 = Obsolete

Don't forget to authenticate first:

https://api.jiwa.com.au/auth?username=a ... d=password

To design your own AutoQueries go to:

https://api.jiwa.com.au/ss_admin/autoquery/

and search for IN_MainQuery using the filter on the left (give it a few seconds to load - there are a lot of tables).
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: inventory item list check

Postby SBarnes » Sat Feb 25, 2023 4:54 pm

That's because you should use InventoryIDIn for multiple Ids, my suggestion is you have a look at the swagger ui as in https://api.jiwa.com.au/swagger-ui, on localhost it will work as well, just give it a minute to come up and use try it out once you expand the sections it will show you the equivalent in curl and obviously from there you can work it out, you need to login using the get call under auth first though with a user name and password to make it work.

If you use https://api.jiwa.com.au/swagger-ui the credentials are admin and password.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: inventory item list check

Postby JuiceyBrucey » Sat Feb 25, 2023 4:56 pm

Hi Mike,
I am checking out this method as well.
Queries/InventoryItemList
Thank you.
Mike.Sheen wrote:
Scott.Pearce wrote:You could use an AutoQuery like:

https://api.jiwa.com.au/Queries/IN_Main ... tNo,Status


/Queries/InventoryItemList has more than just the main table - joins in classification, categories and even stock level - so might be a better fit... it all depends.

If you don't know about AutoQuery conventions, then you should look at the official docs, but to give you the one minute summary:

  • Provides a route per table or view
  • Provides pagination via skip, take and orderby, orderbydesc parameters
  • All fields are filterable via simple conventions - eg: ?NameStartsWith=Mi will filter the column Name, returning only those starting with the letters 'Mi', NameContainsWith=Mi will return only those containing the letters 'Mi'.
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: inventory item list check

Postby JuiceyBrucey » Sat Feb 25, 2023 5:48 pm

That worked! Tried it with three items.
Excellent. The only issue now is that the Status field is not showing up.
How do I sort that out?
**** UPDATE ****
Field is not returned if value is zero. No problem, I can work with that.
Thanks again.

SBarnes wrote:That's because you should use InventoryIDIn for multiple Ids, my suggestion is you have a look at the swagger ui as in https://api.jiwa.com.au/swagger-ui, on localhost it will work as well, just give it a minute to come up and use try it out once you expand the sections it will show you the equivalent in curl and obviously from there you can work it out, you need to login using the get call under auth first though with a user name and password to make it work.

If you use https://api.jiwa.com.au/swagger-ui the credentials are admin and password.
Last edited by JuiceyBrucey on Mon Feb 27, 2023 9:05 am, edited 1 time in total.
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 29 guests