Skip to main content
Question

Control HUB REST API for Authorization


sreenivasaraovaka
Fan

I’m running below command in my windows machine for Auth token and getting below error message. 

curl -s -X POST -d '{"userName":"userid", "password": "password"}' https://cloud.streamsets.com/security/public-rest/v1/authentication/login -H "Content-Type:application/json" -H "X-Requested-By:SCH"

 

Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "Content-Type:application/json" value of type "System.String" to type "System.Collections.IDictionary".
At line:1 char:168
+ ... st/v1/authentication/login -H "Content-Type:application/json" -H "X-R ...
+                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 

Can you please help? 

 

4 replies

dima
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 83 replies
  • April 21, 2022

This looks to be a PowerShell issue. See the following from Stack Overflow: https://stackoverflow.com/questions/45183355/invoke-webrequest-cannot-bind-parameter-headers


sreenivasaraovaka
Fan

I was able to run with curl.exe in windows but I am not getting the response. 

Here the sample response. 

# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

 


Drew Kreiger
Rock star
Forum|alt.badge.img
  • Senior Community Builder at StreamSets
  • 95 replies
  • April 28, 2022

swayam
Discovered Fame
Forum|alt.badge.img
  • Discovered Fame
  • 20 replies
  • April 29, 2022

Hi @sreenivasaraovaka 

Can you try below - it’s working for me. The token will be saved in file cookie.txt.

 

curl -X POST -d '{"userName":"userid", "password": "password"}' https://cloud.streamsets.com/security/public-rest/v1/authentication/login --header "Content-Type:application/json" --header "X-Requested-By:SCH" -c cookie.txt


Reply