HPE SimpliVity

Problem about testing Simplivity Token API

 
FelixTsai
Occasional Visitor

Problem about testing Simplivity Token API

Hi

I use postman to test the simplivity token api but the server response the message as following:

{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"Received unexpected jsonNode grant_type"}}

How could it be resolved?

4 REPLIES 4
DamianErangey
HPE Pro

Re: Problem about testing Simplivity Token API

Can you post the API auth request ?


I work for HPE

Accept or Kudo

FelixTsai
Occasional Visitor

Re: Problem about testing Simplivity Token API

Request URL: https://simplivity@{{OVC_IP}}/api/oauth/token

Method: POST

Headers: Accept and Content-Type are set as application/json

Body: raw request and use json data as below

{
    "grant_type""password",
    "username""hcimonitor@vsphere.local",
    "password""Mon.1000!"
}
US_SimpliVity
Valued Contributor

Re: Problem about testing Simplivity Token API

Here is an example of obtaining and using an access token:

Request an expiring token from the OVC at ip address xx.xx.xx.xx using username 'administrator@vsphere.local' and password 'MySecretPassword!':
curl -k https://simplivity@xx.xx.xx.xx/api/oauth/token -d grant_type=password -d username='administrator@vsphere.local' -d password='MySecretPassword!'

Results are displayed:
{"access_token":"42630e4f-211d-444c-b332-b4fcd0c979f1","token_type":"bearer","expires_in":86399,"scope":"read write","updated_at":1604506169367}

Use the returned access token "42630e4f-211d-444c-b332-b4fcd0c979f1" to request information from the OVC REST API:
curl -k -X GET -H "Authorization: Bearer 42630e4f-211d-444c-b332-b4fcd0c979f1" -H "Accept: application/json" "https://xx.xx.xx.xx/api/hosts?show_optional_fields=false&limit=500&offset=0&case=sensitive"

Results will be displayed.

I am an HPE employee

Shivam1
HPE Pro

Re: Problem about testing Simplivity Token API

Hi,

 

I see issues with the paswword characters, can you redeuce the complexity of password and check the API call.


I work for HPE

Accept or Kudo