Got it

OceanStor REST api authorization

Created: Aug 25, 2020 20:26:17Latest reply: Oct 14, 2020 00:38:08 904 4 1 0 0
  HiCoins as reward: 0 (problem unresolved)

Hello!


I`m trying to automate oceanstor configuration with python script and rest api.


Here is my Python code for authorization


payload = {'username':'testuser', 'password':'AaBbCc.3', 'scope':'0'}

r = requests.post('https://10.XX.XXX.XX:8088/deviceManager/rest/xxxxx/sessions', params=payload, verify=False)


When execute it I get an error

In [34]: r.text
Out[34]: '{"data":{},"error":{"code":50331651,"description":"The entered parameter is incorrect.","suggestion":"Enter a correct parameter."}}\n'


URL looks to be correct

In [33]: r.url
Out[33]: 'https://10.XX.XXX.XX:8088/deviceManager/rest/xxxxx/sessions?username=testuser&password=AaBbCc.3&scope=0'


I have no idea what is wrong. Username/Password is correct, I created it special for this test and I can log in to storage.

I would appreciate for any coments.


Thanks!


Featured Answers

Recommended answer

little_fish
Admin Created Aug 26, 2020 00:47:39

Dear user,

The POST method is used to create managed objects. The parameters to be delivered are defined in the request body.

Creating a managed object:

Example: Use IP address 192.168.1.10 to create user test on device abcd:

URI: https://192.168.1.10:8088/deviceManager/rest/abcd/user

METHOD:POST

Request body:

{

"TYPE":202,

"NAME":"test",

"SCOPE":0,

"LEVEL":2,

"PASSWORD":"Admin@storage1",

"DESCRIPTION":""

}

Normal response:

{

"error":{"code":0,"description":"0"}

}

More information about OceanStor DeviceManager APIs

https://support.huawei.com/enterprise/en/doc/EDOC1000138414?section=j005

Thank you.

View more
  • x
  • convention:

All Answers
Hi user,

Thanks for your question in the Support Community.

One of our experts will answer you soon.

Regards,

HAzcanio
View more
  • x
  • convention:

Dear user,

The POST method is used to create managed objects. The parameters to be delivered are defined in the request body.

Creating a managed object:

Example: Use IP address 192.168.1.10 to create user test on device abcd:

URI: https://192.168.1.10:8088/deviceManager/rest/abcd/user

METHOD:POST

Request body:

{

"TYPE":202,

"NAME":"test",

"SCOPE":0,

"LEVEL":2,

"PASSWORD":"Admin@storage1",

"DESCRIPTION":""

}

Normal response:

{

"error":{"code":0,"description":"0"}

}

More information about OceanStor DeviceManager APIs

https://support.huawei.com/enterprise/en/doc/EDOC1000138414?section=j005

Thank you.

View more
  • x
  • convention:

To get deviceid (abcd) you need to auth first.

I also have same problem with REST authorization. Could someone help up to solve this issue?
View more
  • x
  • convention:

Posted by Efimovskiy at 2020-10-13 21:42 To get deviceid (abcd) you need to auth first.I also have same problem with REST authorization. Coul ...
Dear, maybe this case can help you. https://forum.huawei.com/enterprise/en/devicemanager-rest-api/thread/386663-891
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.