Skip to main content
Solved

Issues with rest API Command: POST Install Client


Juergen
Byte
Forum|alt.badge.img+8

I have following problem when I try a more complex password with chars like ‘#~’ I got error: Request body is empty or format is invalid.

If I try a simply password like the sample :”cXE=” it work well.

 

I use V11SP20.40

thanks.

Regards

Jürgen

Best answer by Juergen

@Stuart Painter

I got it now working! I need to use the encrypted using Base64 UTF-8 encoding in the body the install for as well.

thanks for your help.

regards Jürgen

View original
Did this answer your question?

6 replies

Forum|alt.badge.img+15

Hi @Juergen 

Thank you for the question and welcome to the Community!

REST API passwords are encrypted using Base64 UTF-8 encoding, so it may be that if your character set uses different encoding, these may not get encrypted correctly before sending.

Please see REST API - Authentication for more info.

You can check REST API process and view the post requests before sending in the sandbox environment - REST API - Test Environment.

When you enter credentials in the sandbox environment, you should see the headers populate to check if these values are getting properly encrypted as you would expect.

Thanks,

Stuart

 


Juergen
Byte
Forum|alt.badge.img+8
  • Author
  • Byte
  • 44 replies
  • April 13, 2021

Hello @Stuart Painter ,

I can logon with my password to API, but it do not work in the body for the “post install client” API command.

thanks for quick answer.

 

regards Jürgen

 


Forum|alt.badge.img+15

Hi @Juergen 

Ok, so let’s clarify, you can login successfully to REST API - are other requests working as expected, e.g. GET Client?

Is it just the POST Install Client request that’s not working for you?

What is the API request you are attempting to execute?

Thanks,

Stuart


Juergen
Byte
Forum|alt.badge.img+8
  • Author
  • Byte
  • 44 replies
  • April 13, 2021

Hi @Stuart Painter ,

GET CLIENT works others too.

only this makes trouble :

 

import requests

url = "http://WebConsoleHostName/webconsole/api/InstallClient"

payload = "{\n    \"rebootClient\": false,\n    \"createPseudoClientRequest\": {\n        \"registerClient\": true,\n        \"clientInfo\": {\n            \"clientType\": 0,\n            \"plan\": {\n                \"planId\": 1\n            },\n            \"subclientInfo\": {\n                \"fsSubClientProp\": {\n                    \"useGlobalFilters\": \"USE_CELL_LEVEL_POLICY\",\n                    \"backupSystemState\": true\n                },\n                \"useLocalContent\": true,\n                \"contentOperationType\": 1,\n                \"content\": [\n                    {\n                        \"path\": \"\\\\%Office%\"\n                    },\n                    {\n                        \"path\": \"D:\\\\adminconsole\\\\Webcontent\"\n                    },\n                    {\n                        \"path\": \"\\\\%Desktop%\"\n                    },\n                    {\n                        \"path\": \"\\\\%Documents%\"\n                    },\n                    {\n                        \"path\": \"\\\\%Music%\"\n                    },\n                    {\n                        \"path\": \"\\\\%Pictures%\"\n                    },\n                    {\n                        \"path\": \"\\\\%Videos%\"\n                    },\n                    {\n                        \"excludePath\": \"\\\\%Home%\"\n                    },\n                    {\n                        \"excludePath\": \"\\\\%Archives%\"\n                    },\n                    {\n                        \"excludePath\": \"\\\\%Cloud app%\"\n                    },\n                    {\n                        \"excludePath\": \"C:\\\\excludeContent\"\n                    },\n                    {\n                        \"includePath\": \"C:\\\\ExceptionContent\"\n                    }\n                ]\n            }\n        }\n    },\n    \"packages\": [\n        {\n            \"packageId\": 702,\n            \"packageName\": \"File System\"\n        }\n    ],\n    \"clientAuthForJob\": {\n        \"userName\": \"manoj\\\\administrator\",\n        \"password\": \"cXE=\"\n    },\n    \"entities\": [\n        {\n            \"clientId\": 0,\n            \"clientName\": \"TestInstallClient1\",\n            \"hostName\": \"TestInstallClient1.manoj.com\"\n        },\n        {\n            \"clientId\": 0,\n            \"clientName\": \"TestInstallClient2\",\n            \"hostName\": \"TestInstallClient2.manoj.com\"\n        }\n    ]\n}"
headers = {
  'Accept': 'application/json',
  'Content-Type': '{{Content-type}}',
  'Authtoken': '{{Authtoken}}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

 

this is the sample from: https://api.commvault.com/?version=latest#1fb3fec7-ef98-4bff-8f1c-48c6f1968aeb

it’s working with this simple password, but not with any more complex passwords which have special character in it!

 

regards jürgen

 


Juergen
Byte
Forum|alt.badge.img+8
  • Author
  • Byte
  • 44 replies
  • Answer
  • April 13, 2021

@Stuart Painter

I got it now working! I need to use the encrypted using Base64 UTF-8 encoding in the body the install for as well.

thanks for your help.

regards Jürgen


Forum|alt.badge.img+15

Hi @Juergen 

Thanks, that’s great to hear, I’m glad you got it working.

I’ll mark your post as Best Answer.

Thanks,

Stuart


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings