Jump to content
Gagan

Passwordstate API

Recommended Posts

Hello Everyone,

While creating the Host API key and trying to connect using the host key, we are getting below errors.We have also created the new key and then tried but still the same error. 

 

[{"errors":[{"message":"No Authorization"},{"phrase":"An error has occurred trying to validate the Hosts API Key. Please check if the System Wide Hosts API Key value is correct."}]}]

 

Can someone help in this ? why this error is getting though we have created the system wide API key. Also having the admin level access.

 

We are trying to use below -
# Searching for all SQL Servers

curl https://passwordstate/api/hosts/?SQLServer=True&apikey=<value>

 

Note : We are using the latest build i.e. 7868

 

Thanks,

Gagan

Share this post


Link to post
Share on other sites

Hi Gagan,

 

We think the terminology we have in this error message is confusing, and we'll change it in a future build.  What it should be asking for is the Hosts Key, not the "System Wide Host Key"  This confuses it with the "System Wide" API key which shouldn't be used for this type of call.

 

Can you try using the Hosts key under system settings in your script, and let me know if that fixes the issue?  Here is a screenshot of this key for your reference:

 

2017-04-26_9-45-01.png

 

Regards,

Click Studios Support

 

Share this post


Link to post
Share on other sites

Team,

 

We are doing the same as you mentioned above, we also regenerated the key and tried it again, but no luck and similar error occurred. Even we tried the url till "https://passwordstate/api/hosts/" but showing the same error. Till /api we are good and able to see the document of same.

Not sure why this is happening.

 

Thanks,

Gagan

 

 

Share this post


Link to post
Share on other sites

Hi Gagan,

 

Next thing to try is restarting IIS on your web server, and try to run the script again?

 

Also, if you have a windows machine you can run a Powershell script on, could you try my example script below?  All you need to do is insert your Hosts API key in place of mine, and it should return all Hosts that are tagged as a SQL machine.

 

$APIURL = "https://sandbox.halox.net/api/hosts/?SQLServer=True"
$result = Invoke-Restmethod -Method Get -Uri $APIURL -Header @{ "APIKey" = "be598cf3a64327dd49be3683a75f2c21" }
Write-Output $result.HostName #Return specific property of object(s)

 

 

Hope this helps,

Support:)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...