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

Server API commands with/without authentication

silvia_cicerone
Established Member

Server API commands with/without authentication

Hello, 

I'm using the Server API to export the live alarm and alarm history from WebIQ. 

The API Reference manual says that the alarm.live command, for instance, doesn't require a logged in user.

2022-07-07_11h30_54.png

However, if I try to send the alarm.live command without sending the user.login command, it gives an "access denied" message back.

2022-07-07_11h34_43.png

On the other hand, if I send the user.login command before and then the alarm.live command, I'm able to authenticate and to access the alarms.

2022-07-07_11h35_28.png

2022-07-07_11h35_39.png

So, is authentication necessary for it? Or is there anything I'm doing wrong?

Thank you!

Silvia

2 REPLIES 2
bostroemc
Long-established Member

Re: Server API commands with/without authentication

I've found other cases that exhibit the same behaviour.  For example, accessing item.get with request 

{
"cmd": "item.get",
"id": 0,
"data": "start"
}

yields without login:

{
"cmd": "item.get",
"data": null,
"error": {
"category": "shmi:connect:api:generic",
"errc": 4,
"message": "access denied"
},
"fragmented": false,
"id": 0
}

but with login:

{
"cmd": "item.get",
"data": {
"access_group": null,
"alias": "start",
"attributes": {},
"audit": false,
"data_type": null,
"description": null,
"digits": -1,
"interval": 100,
"label": null,
"max": null,
"min": null,
"name": {
"namespace": 2,
"node": "plc/app/Application/sym/GVL_EM00_HMI/bStart_HMI_gb"
},
"prewarn_enable": false,
"prewarn_max": null,
"prewarn_min": null,
"recorder_threshold": null,
"server": "ctrlX_CORE",
"simulation": null,
"step": null,
"transform": null,
"trend_max": null,
"trend_min": null,
"unit": null,
"update_function": null,
"update_param": null,
"warn_enable": false,
"warn_max": null,
"warn_min": null
},
"error": null,
"fragmented": false,
"id": 0
}

Like alarm.live, the documentation indicates that item.get does not require user login.

BTW: There are examples where login is not required.  For instance, connect.info:

Untitled.png

I suspect the documentation just needs to be updated.

webiq-sk
Occasional Contributor

Re: Server API commands with/without authentication

The "requires loggedin user" actually refers to an internal user context which is unfortunately not described in the documentation. But we will change that in the future to explain what it really means in the document.

In essence it does NOT mean that a user has to be logged in or not so currently you cannot deduct from the available information whether a login is required or not.

We apologize for the inconvenience.

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