REST API print multiple labels in the same request
Hello,
I am attempting to print labels with REST API, but want to include multiple records of data in the same payload (request body). I am attempting to use JSON and add multiple records to the NamedDatasource section. Seems to print the first label, but nothing else.
could someone provide a sample json that I could use as an example to get my code working. OR is it not possible.
I noticed a similar issue when trying to use json input variables in an web service integration and ended up having to go the csv route and add some extra actions to get it to work.
Any suggestions or assistance appreciated.
-
Ryan Lounsbury
★ BarTender Hero ★
*I did find a 6-year old thread saying that Bartender web service integration does not support JSON arrays. Surely this has been addressed by now?
I have the same issue trying to do the same thing. I've read in multiple places that this appears to be possible but only with BTXML examples no JSON examples. In theory I should be able to the following snippet of JSON in the body of the request and get 2 labels out:
{"PrinterName": "TESTPRN","Copies": 2,"DESC": "DESCRIPTION TEXT","OPER": "TEST2","PACK": "2.00","SKU": "TEST2","UPC": "987456123"},{"PrinterName": "TESTPRN","Copies": 2,"DESC": "DESCRIPTION TEXT","OPER": "TEST","PACK": "2.00","SKU": "TEST","UPC": "123456789"}But I get the same result. Only the second section of JSON gets rendered into a printed label by the web integration.0 -
Peter Lykkegaard
★ BarTender Hero ★
In Bartender 2022 you can use an ActionGroup as header and an array of Actions
Code:
{
"ActionGroup":
{
"Actions":
[{
"PrintBTWAction":
{
"DocumentFile": "labels.btw",
"Printer": "APrinter",
"Copies": 1,
"NamedDataSources":
{
"Data": "1",
}
}
},
{
"PrintBTWAction": {
"DocumentFile": "labels.btw",
"Printer": "APrinter",
"Copies": 1,
"NamedDataSources":
{
"Data": "2",
}
}
}]
}
}0
Please sign in to leave a comment.
Comments
2 comments