cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HCP IoT - Problem with Receiving Messages from MMS

seVladimirs
Active Contributor
0 Kudos

Hi,

Not sure why, I was able to push message toDevice, but receive it from IoT MMS.

Table T_IOT_HTTP_PUSH contains pushed message, see beow,

When I'm doing https://iotmms<account_id>trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/d000...GET request I don't receive it back - see below.

Accepted Solutions (1)

Accepted Solutions (1)

anton_levin
Advisor
Advisor
0 Kudos

Hi Vladimirs,

Data APIs are protected with OAuth SAP HANA Cloud Platform Internet of Things (IoT) Services

When you do a GET request from the browser there is no Authorization: Bearer <token> header.

Either use tools like Postman or your own client implementation. See Starter Kit for references https://github.com/SAP/iot-starterkit

Regards,

Anton

seVladimirs
Active Contributor
0 Kudos

Thanks Anton,

I also tried with OAuth - same result

anton_levin
Advisor
Advisor
0 Kudos

"d000-*" device ID at the end of your URL is an embedded one, you have to use a real device ID (which you have registered) in IoT Cockpit.

P.S. and of course push some messaged to that device beforehand

seVladimirs
Active Contributor
0 Kudos

Thanks!

Here is more screenshots.

MMS Device ID:

Generated OAuth for Authorization

MessageType

POST request

T_IOT_HTTP_PUSH TABLE

Get request

anton_levin
Advisor
Advisor
0 Kudos

For the last step, could you close and open all your browser windows? Maybe RESTful client re-used an existing session from the "push" step where Basic Auth was used. Just a guess. If not, we would need to see in details, logs etc.

seVladimirs
Active Contributor
0 Kudos

Thanks! You are right. It works with new Chrome Session.

Answers (1)

Answers (1)

WouterLemaire
Active Contributor
0 Kudos

The deviceid is different in your get ... the deviceid has to be the same in the push and the get.

Kind regards,

Wouter

seVladimirs
Active Contributor
0 Kudos

I have this dummy device registered.

WouterLemaire
Active Contributor
0 Kudos

Are you pushing to http or websocket? in case of websocket change your url:

https://iotmms<account_id>trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/ws/data/d000-e...

anton_levin
Advisor
Advisor
0 Kudos

Hi Wouter,

you mixed up the APIs. There is no http://.../ws/data/ endoint exposed by MMS. In order to Push a message over WS you set "method" attribute in body to "ws" https://help.hana.ondemand.com/iot/frameset.htm?9da1c18f6ab947c58052f4d07498a654.html

There is a wss://../ws/data/ endpoint but is it used to send the messages FROM the device to MMS https://help.hana.ondemand.com/iot/frameset.htm?e12d1429ddcb469ebed59746b64e16ae.html

Regards,

Anton

WouterLemaire
Active Contributor
0 Kudos

indeed I was mixing it up my apologies !