Product Images and Reports  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Product Images and Reports

Postby SBarnes » Sat Jun 17, 2017 12:53 am

Hi Mike,

The ability to run reports and receive them back as a pdf would be a nice addition but more importantly would be the possibility of getting product images passed back say in the response stream.

Both however, may be beyond the strict definition of a REST API however most web carts would show product images and would give you the functionality to view invoices, orders and statements etc.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Product Images and Reports

Postby Mike.Sheen » Sat Jun 17, 2017 10:55 am

SBarnes wrote:Hi Mike,

The ability to run reports and receive them back as a pdf would be a nice addition but more importantly would be the possibility of getting product images passed back say in the response stream.

Both however, may be beyond the strict definition of a REST API however most web carts would show product images and would give you the functionality to view invoices, orders and statements etc.


Hi Stuart,

Images we already handle - a GET on /Inventory or /Inventory/{InventoryID} will include the picture of the product as base64 encoded - and the POST and PATCH operations allow you to set the picture.
We also added pictures to inventory categories - and you can retrieve or set those much like inventory.
For cases where you want multiple pictures per product, just create a document type of "Image" or similar, and you can GET, POST and PATCH documents per product - so you can retrieve all the documents with a type of "image" for a product and this should achieve what you want.

As for reports returned as PDF - this should be pretty simple - I'll have a go at it.

Mike
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: Product Images and Reports

Postby Mike.Sheen » Sun Jun 18, 2017 12:35 pm

Attached is a plugin which kinda works.

I say kinda because sometimes the PDF is blank - I think maybe crystal reports is not flushing a buffer or something before I return the document - so some tweaking still required.
UPDATE: I think I have it fixed now - revised plugin attached - except when using the download link from the Swagger UI - it seems to be corrupting the file, but just putting the URL in a browser works - this seems to be a known, ongoing issue with Swagger UI

The plugin adds a route for Reports/{ReportID}/PDF/Download.

If there are parameters to pass the report then the request has a List of Name Value pairs of the crystal report formula parameters.

An example in demo data is the DB GL Reconciliation report - which has no parameters - it has a ReportID of 31ac45c5-34dd-42f3-8860-1b70ff4f0931

So, in a browser, visiting /Reports/31ac45c5-34dd-42f3-8860-1b70ff4f0931/PDF/Download will download the PDF.

Visiting this in the SwaggerUI, you'll get a 200 response and a link to download the PDF.
Attachments
Plugin Sample download report as PDF for REST API.xml
Updated Sample Plugin
(29.69 KiB) Downloaded 201 times
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: Product Images and Reports

Postby SBarnes » Sun Jun 18, 2017 1:16 pm

Hi Mike,

Thanks I'll take a look at it, interestingly on another front I've tested the documents interface by adding an image as a document to a sales order coming from Xamarin with the idea of doing a "sign on screen" for POD on an order.

There are some peculiarities to get ServiceStack up and running in a PCL (Portable Class Library) project which the preferred project type for Xamarin forms, so once I've listed out the steps properly I'll put them in another post in case its of any use to someone in the future but it works for both IOS and Android.

PS By the way having the API code in a plugin is a brilliant idea, it's kind of self documenting in seeing what you have to do to get something up and running as you can read the code.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Product Images and Reports  Topic is solved

Postby Mike.Sheen » Sun Jun 18, 2017 1:56 pm

SBarnes wrote:so once I've listed out the steps properly I'll put them in another post in case its of any use to someone in the future but it works for both IOS and Android.


That'd be great - much appreciated

SBarnes wrote:PS By the way having the API code in a plugin is a brilliant idea, it's kind of self documenting in seeing what you have to do to get something up and running as you can read the code.


Thanks - I might quote you on that - there are some who don't think it's such a good idea.

BTW - I'm not sure if you've seen this, but seeing as you asked about Razor views before I've made a post about our initial support in this topic.
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


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests