Skip to content
STAGING SERVER
DEVELOPMENT SERVER

Basler Vision Connector Messaging: Uploading a Recipe#

To use a recipe in the Basler Vision Connector created in the pylon Viewer, you must upload the file to the Basler Vision Connector. Every recipe file in the Basler Vision Connector is stored under a unique name (no directories are supported). The file must have the file extension *.precipe. When uploading a recipe file, ensure that no file with the same name already exists.

The file can be uploaded in two different ways:

  • Either transmit the recipe file in Base64-encoded form embedded in the JSON request via a data URI.
  • Or transmit the recipe file in raw form as a separate message part using a proprietary message part URI (not supported for MQTT because MQTT doesn't support multipart messages).

Message Envelope for ZeroMQ Messages Using Data URI#

Frame Field Description Type
1 payload Method payload Binary String (UTF-8)

Message Envelope for ZeroMQ Messages Using Message Part URI#

Frame Field Description Type
1 payload Method payload Binary String (UTF-8)
2 recipe Recipe file Binary Recipe Data

JSON Payload#

Field Optional Type Description
TransactionID Yes String Transaction identification
Action No String Method called. Fixed value: cstm_UploadRecipe
FileName No String File name under which the recipe file is stored. Sub-directories aren't supported. The recipe file name must have the file extension .precipe.
FileContent No String URI with the Base64-encoded recipe data or a reference to the recipe data.a If you use MQTT, the recipe data must be embedded in Base64-encoded form.
Supported MIME types: application/octet-stream and application/json.

  1. Two options are supported here:

    • Data URI with Base64-encoded recipe data:
      Syntax: data:{MIME-Type};base64,{Base64-Encoded-Recipe-Data}
      Example: data:application/octet-stream;base64,ewogICJQeW... (truncated)
    • Message part URI with MIME-Type (not supported for MQTT):
      Syntax: msgpart:{Zero-Based-Message-Part-Index};{MIME-Type}
      Example: msgpart:1;application/octet-stream

Example Using a Data URI:

{
  "TransactionID": "234423465465",
  "Action" : "cstm_UploadRecipe",
  "FileName" : "MyRecipe.precipe",
  "FileContent" : "data:application/octet-stream;base64,ewogICJQeWxvbk1ldGFEYXRhI[...]"
}

Example Using a Message Part URI:

{
  "TransactionID": "234423465465",
  "Action" : "cstm_UploadRecipe",
  "FileName" : "MyRecipe.precipe",
  "FileContent" : "msgpart:1;application/octet-stream"
}

Response Object#

Field Optional Type Description
TransactionID Yes String Transaction identification
ReturnCode No Integer Message code following Message Codes
Message No String Response message
{
  "TransactionID": "234423465465",
  "ReturnCode": 0,
  "Message": "Recipe uploaded."
}