cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

REST API to collect data

REST API to collect data

redford
Long-established Member

I want to read values in the datalayer via the RestAPI. This works for single variables without problems. I would like to read whole nodes with subnodes and associated variables and get the result as json. Based on the example project allprovider.data (main node "sdk-cpp-alldata", 2 subfolders "dynamic" and "string", each containing different variables) the response of the Get command as json should look something like this.

{

                „sdk-cpp-alldata“: {

                               „type“: „arstring“,

                               „value“: [

                                               „dynamic“: {

„bool8“: {

                „type“: „bool8“,

                „value“: true

}

„int16“: {

                „type“: „int16“,

                „value“: 100

}

                                               }

                                               „static“: {

                                                               …

                                               }

                               }

                }

}

The Background is that I want to execute only one http get command. Then I want to process the whole json so that I can read all variables from it. Is this possible and if so how?

2 REPLIES 2

CodeShepherd
Community Moderator
Community Moderator

This is not possible in general for each node. The provider of these node would have to implement this function (like in Data Layer under framework/bundles). Right now you would have to do a browse and then see all the nodes below and decide from which you like to read the value or do another browse.

We are actually working on a bulk read function that will be released end of November in version 1.18 of the system. But you will have to tell the read command always which pathes should be read.

Just posted a example for bulk read and subscribe in this topic.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist