Skip to Content
0

Api for getting the Device Oauth token

Nov 21, 2017 at 04:10 PM

31

avatar image
Former Member

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- trial.hanatrial.ondemand.com/com.sap.iotservices.dms/v2/api/devices/ /authentification

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

10 |10000 characters needed characters left characters exceeded
Former Member

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

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anton Levin
Nov 21, 2017 at 04:22 PM
0

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/65c78920d83f4e8cac6ac15e2aa07da0.html#loio3b7ea87e04f24c369a784321a66f1dd8

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

The new url looks like this:

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

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>

0
Former Member

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

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

0

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.

1
Former Member

Thank you Anton!

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

Have a good night!

David

0