Saltar al contenido principal

Búsqueda

Búsqueda

REST API based integration with JSON Label Data

Comentarios

5 comentarios

  • Avatar
    Rajath Muthyala

    Hi Justin, 

    Based on the provided JSON payload, it seems there was an issue with the formatting of the "labels" array. I encountered a similar problem when attempting to add the JSON data to my template as embedded data.

    Upon closer inspection, it appears that the backslashes before the quotes in the "labels" string were causing the JSON validation to fail. The correct format for the "labels" array should be without the escape characters:

    [ {"Barcode":"0448c96b-063e-41a1-8677-6e25becf5bcf","Sample ID":"QCS_0253"}, {"Barcode":"9d71cfec-7aa3-426d-b151-39aabf494f16","Sample ID":"QCS_0252"} ]

    After removing the backslashes, the JSON payload worked seamlessly with the BarTender template, allowing it to load up multiple records successfully. I recommend giving this revised format a try in your integration. Let me know how you go.

     

     

    0
  • Avatar
    Gshreenivasan

    It's not clear if you answered Justin's question. I think there is a lack of samples in sending arrays of json data in the payload to the REST API (There is some documentation for the XML version). Can someone please produce a successful "database" binding using a json array posted to the RESP API end point?

    1
  • Avatar
    Rajath Muthyala

    You're right, I don't think I answered the question. See if this helps.

    Yes, to override the data in BTIN you need to do database overrides.

    You said that you are either getting blank or embedded sample data when triggered. This could be happening if in the BTIN print actions database overrides you have changed the "Database to override" to a specific name or variable instead of the default "(The default database)"

    If you did, either delete the database override and add it again, or you can change the name of the embedded sample data file in the .btw file such that they match.

    With regards to an example to send and print arrays using Post rest action, I choose to do it using BTIN rather than the Rest API, but it should be almost the same. Here is an example.

    {

    "BTDRFile": "\\\\N01\\Shared\\Bartender\\Bartender Integrations\\Testing.btw",
    "Printer": "Intermec EasyCoder PX6i (300 dpi)",
    "Copies": "1",
    "Trigger": "5",
    "Array": [{
    "Text1": "Hello World",
    "Text2": "Text 1"
    },
    {
    "Text1": "Hello World 2",
    "Text2": "Text 2"
    }]
    }

     

    This example produces 2 labels with different data. Text1 and Text2 are then connected to named data sources in the .btw file. Let me know if you have any questions.

     

     

    0
  • Avatar
    Gshreenivasan
    I am trying to POST to the REST API, here is my json. What is wrong or should be different? My database in the btw file is called "Aircrafts" and has a table of embedded data called "JSON" that I want to override using the following payload. Thanks for any help you can offer.
     
    {"libraryID":"8a42c7ca-2d53-4316-9cd7-4d638bf4fa2b","relativePath":"Giri/Airplanes2.btw","printer":"PDF","copies":1, "Recordset": {
        "Name": "Aircrafts",
        "embeddedData":
    [
    {"Model":"173","Manufacturer":"Cessna","Years":1932},
    {"Model":"StagsgerWing","Manufacturer":"Beechcraft","Years":1256},
    {"Model":"Kincg Air","Manufacturer":"Beechcraft", "Years":1264},
    {"Model":"1820","Manufacturer":"Cessna", "Years":2953},
    {"Model":"1714","Manufacturer":"Beechcraft", "Years":1322}
    ]
    }
    }
    0
  • Avatar
    Rajath Muthyala

    Hi Gshreenivasan,

    I am not well-versed in the REST API, I did find this post by another user. Link

    You can also check out Bartender YAML reference for the same. Link

    I found integration builder is much more simpler to work from and gives much more flexibility. Is there a reason you would prefer using RestAPI instead of BTIN?

    0

Iniciar sesión para dejar un comentario.