From 312bc7d0ec41b3ec76ff9f17fef215429c1c4660 Mon Sep 17 00:00:00 2001 From: asi-ubi <67101052+asi-ubi@users.noreply.github.com> Date: Thu, 10 Dec 2020 10:47:18 +0300 Subject: [PATCH] Update device_rest.php --- Reference/Common/Library/device_rest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Reference/Common/Library/device_rest.php b/Reference/Common/Library/device_rest.php index 1159aea81..155bb6090 100755 --- a/Reference/Common/Library/device_rest.php +++ b/Reference/Common/Library/device_rest.php @@ -61,6 +61,24 @@ function _device_create ($customer_id, $device_name, $manufacturer_id, return $response; } +/** + * curl -u ncroot:Ub1qub3 -XGET http://localhost:80/ubi-api-rest/device/id/104 + * + */ +function _device_read_by_id ($device_id) { + + $msa_rest_api = "device/id/{$device_id}"; + $curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api); + $response = perform_curl_operation($curl_cmd, "READ DEVICE BY ID"); + $response = json_decode($response, true); + if ($response['wo_status'] !== ENDED) { + $response = json_encode($response); + return $response; + } + $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']); + return $response; +} + /** *
* curl -u ncroot:ubiqube -XDELETE http://localhost:10080/ubi-api-rest/device/id/1671