CRBasic Program Download ======================== Command the data logger to download a CRBasic Program via HTTP GET from a URL. If successful, the program will be compiled, and set as run on power up. **Topic Structure:** ``/cc//program`` .. admonition:: Properties - ``"url":`` {*string*} Full path and file name of the program on the server. - ``"fileName":`` {*string*} Desired name of the program on the data logger. This can be a new name or the same name on the server. - ``"tranID":`` *(optional)* **Example command:** :guilabel:`Subscribe` ``cs/v2/cc/ABCD-EFGH-1234/program`` .. code-block:: json { "url": "https://DataThings.com/Documents/CRBasic/Data0xB6.crb", "fileName":"Data0xB6.crb", "tranID": "0668a496-568d-4b04-8cdf-7b139eb5fc3f" } **Progress** Progress of the program download will be published on the state topic. :guilabel:`Publish` ``cs/v2/state/ABCD-EFGH-1234`` - Download Started .. code-block:: json { "clientId": "ABCD-EFGH-1234", "state": "online", "fileTransfer": "Program file download" } - Loading Program .. code-block:: json { "clientId": "ABCD-EFGH-1234", "state": "offline", "reason": "Loading program" } .. note:: The data logger is attempting to compile the program during this phase. Communications will remain offline until compilation is complete. - Complete .. code-block:: json { "clientId": "ABCD-EFGH-1234", "state": "online" } **Response** :guilabel:`Publish` ``cs/v2/cr/ABCD-EFGH-1234/program/0668a496-568d-4b04-8cdf-7b139eb5fc3f`` In addition to the State topic messages, the data logger will publish a final result of the program download on the ``cr`` topic. .. code-block:: json { "success": "Program loaded successfully" } .. admonition:: Error Responses - ``{"error": "Program download failed"}`` - ``{"error": "JSON missing program URL"}`` - ``{"error": "JSON missing file name"}``