Multiple records with web service integration S’abonner

0
Avatar
Richard Jansen

We're running a few (JSON) web service integrations on Bartender 2016 R6. It's all straight forwards and it runs pretty smooth but we'd like to be able to print multiple labels/records within one web service call. Was anyone able to pull this off and how did they do it?

 

Your explanation is much appreciated!

 

Richard.

5 commentaires

0
Avatar
Kris Reddy
Actions pour les commentaires Permalien

Looking for similar solution

Trying out the trial, integration is easy with web service, however we can only only send 1 json item and not an array.

Is there a way bartender can parse json array and print multiple in one web service request?

For example:

[{
"PrinterName":"TEC-SX4"
,"LabelName":"Test.btw"
,"ProductID":"12546"
,"LatinName":"Product 1'"
,"Qty":"2"
},
{
"PrinterName":"TEC-SX4"
,"LabelName":"Test.btw"
,"ProductID":"8956"
,"LatinName":"Product 2'"
,"Qty":"2"
},
....
...]

Is this possible?

Please advise,

Kris

 

 

0
Avatar
Jasper Wen
Modérateur
Actions pour les commentaires Permalien

BarTender's Integration Platform currently doesn't support JSON arrays natively out of the box. We already have a feature request submitted in our system.

At the moment, you can workaround this by using a PowerShell script action to convert a JSON array into a comma separated value format which the Integration Platform and BarTender can interpret. The Powershell script action would be something like this. Of course, you can use Integration variables instead where appropriate.

  1. Have a variable with some JSON data- $jsonArray = '{"PrintJob":[
    {"PrinterName":"TEC-SX4","LabelName":"Test.btw","ProductID":"12546","LatinName":"Product 1","Qty":"2"},
    {"PrinterName":"TEC-SX4","LabelName":"Test.btw","ProductID":"8956","LatinName":"Product 2","Qty":"2"}
    ]}' 
  2. Converts the JSON data into Powershell Object- $jsonArray = $jsonArray | ConvertFrom-JSON
  3. Converts the Powershell object and data into a comma separated value format and assigns it to a variable- $outputCSV = $jsonArray.PrintJob | ConvertTo-Csv -NoTypeInformation

Once you get the data in a CSV format, you then should be able to use the Integration database and print actions such as the transform text to record set, for each database record, and print document action action to print multiple records/labels.

0
Avatar
Steve Williams
Actions pour les commentaires Permalien

Currently I am running tests in the 30 day trial version, trying to pass multiple records to the web service request.

Obviously JSON is fine for passing a single record but I have seen another article in this forum (http://forums.seagullscientific.com/topic/1570-printing-multiple-record-in-an-xml-file-was-working-fine-with-bartender-75-csv/ ) which suggested that it was possible to pass multiple records using BTXML like this below:

<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="Job1">
<Print>
<Format>c:\BarTender\Document1.btw</Format>
<RecordSet Name="Text File 1" Type="btTextFile">
<Delimitation>btDelimQuoteAndComma</Delimitation>
<UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord>
<TextData>
<![CDATA[
"FirstName","LastName","City","Zip Code"
"Adam","Jones","Bellevue","98008",
"John","Smith","Kirkland","98293"
]]>
</TextData>
</RecordSet>
</Print>
</Command>
</XMLScript>

I have tried this but it doesn't work. I don't get any errors. The messages in my Insomnia REST Client show a WaitStatus of "Completed", Validated = true, "BarTender successfully sent the job etc. etc.". The printer produces a blank sheet of paper.

It does print the label correctly if I reconfigure the request for JSON, passing a single JSON item.

Am I missing something? Should I be able to pass multiple records using the BTXML example above?

Thanks.

Steve

0
Avatar
Jason Reibel
Actions pour les commentaires Permalien

Does anyone have an answer to Steve's question? I would like to implement a similar integration.

0
Avatar
Jasper Wen
Modérateur
Actions pour les commentaires Permalien

The BTXML data that Steve Williams has in his previous post looks correct. It could be something that is set incorrectly in the Integration or BarTender document.

For anybody that is running into issues, feel free to reach out to us at tech support here.

Vous devez vous connecter pour laisser un commentaire.