cancel
Showing results for 
Search instead for 
Did you mean: 

Api for getting the Device Oauth token

Former Member
0 Kudos

Hello,

I'm trying to get the oauth token for one of my devices through postman. And while making a POST request to

https://iotrdmsiotservices-<account>trial.hanatrial.ondemand.com/com.sap.iotservices.dms/v2/api/devi...

with the body

{
"type": "oauth
}

I receive every time a raw html page with the title "not found".

Can you please help me with what exactly am I doing wrong in this request?

Thank you,

David

Former Member
0 Kudos

Forgot to mention that after the"iotrdmsiotservices-" and before trial is the ID of my account, and after the "devices" is my device ID.

Thanks,

David

Accepted Solutions (0)

Answers (1)

Answers (1)

anton_levin
Advisor
Advisor
0 Kudos

Hello David,

I see 2 suspicious points in your text:

1. Your URL ends with "/authentification" but has to be "/authentication" or "/authentication/token" (if only you do the token renewal). See documentation [1]

2. Your body is invalid JSON - oauth value is not closed with double quote.

Regards,

Anton

[1] https://help.sap.com/viewer/7436c3125dd5491f939689f18954b1e9/Cloud/en-US/65c78920d83f4e8cac6ac15e2aa...

Former Member
0 Kudos

The new url looks like this:

https://iotrdmsiotservices-XXXtrial.hanatrial.ondemand.com/com.sap.iotservices.dms/v2/api/devices/YY...

Where XXX is the account id, and YYY the device id.

and the new body:

{
"type": "oauth"
}

After changing the above mentioned, i receive

<html>
<head>
<title>Error report</title>
</head>
<body>
<h1>HTTP Status 415 - Unsupported Media Type</h1>
</body>
</html>

Former Member
0 Kudos

Later edit: Same url as above, and body to return JSON(application/json)

{
"errors": [
{
"description": "An authentication is already defined for this entity."
}
]
}

anton_levin
Advisor
Advisor

Please, see in documentation "Once an authentication object is deleted, a new object can be created by using a POST" which means you need to send a DELETE request first.

Former Member
0 Kudos

Thank you Anton!

I wasn't paying attention to what was written there. You helped me a lot.

Have a good night!

David