Skip to Content

SAP HCP IOT Post Data is returning 401 Authorization Error

Hi,

I'm Working on SAP IoT services and trying to consuming in SAPUI5.

I have used the below code to post data using IoT plugin.

var oAuth = "Bearer oAuthCode";
 var message = [{
	  	"location":""+lat+" N,"+lon+" E"
	  }];
var sDeviceId = "00000000-0000-000f00000-94f094f03100";
	  var sMessageTypeId = "00000000000000000000";
	  var seconds =  new Date().getTime();

IOT.postData(sDeviceId,"sync",sMessageTypeId,message,
	  function(result){
	  	sap.m.MessageToast.show("Message sent: "+result);
	  },
	  function(error){
	    sap.m.MessageToast.show("Message Error : "+error.responseText);
	  },
	  {
         headers: {
                "Authorization":oAuth 
        }});

The status code is shown as 401 unauthorized.

Please help me on this.

Thanks and Regards,

Prabhu M.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 05 at 12:42 PM

    Please, see similar thread [1] and the answer by Former Member who suggests to re-check destination settings.

    Regards,

    Anton

    [1] https://answers.sap.com/questions/185527/unable-to-connect-iot-message-management-service-t.html

    Add comment
    10|10000 characters needed characters exceeded