Guest Michael Ryom Posted May 28, 2018 Share Posted May 28, 2018 Hi I'm trying to use the webapi to search for a password. But no matter what I do I cant get a useful output. (Creating/searching folders,password lists, etc. works.) Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title" -Credential $cred Returns "[{"errors":[{"message":"Invalid API Call"},{"phrase":"Error = Object reference not set to an instance of an object."}]}]" if I change it to something incorrect like added a "1" after username or title - It tells me there is no record like expected Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title1" -Credential $cred Returns "[{"errors":[{"message":"Not Found"},{"phrase":"You search for Password records return zero results."}]}]" So why does it return "Invalid API Call", when it should return "password found" ps. if I use the URI in a browser the result is the same. Link to comment Share on other sites More sharing options...
MichaelRyom Posted May 28, 2018 Share Posted May 28, 2018 1 minute ago, Guest Michael Ryom said: Hi I'm trying to use the webapi to search for a password. But no matter what I do I cant get a useful output. (Creating/searching folders,password lists, etc. works.) Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title" -Credential $cred Returns "[{"errors":[{"message":"Invalid API Call"},{"phrase":"Error = Object reference not set to an instance of an object."}]}]" if I change it to something incorrect like added a "1" after username or title - It tells me there is no record like expected Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title1" -Credential $cred Returns "[{"errors":[{"message":"Not Found"},{"phrase":"You search for Password records return zero results."}]}]" So why does it return "Invalid API Call", when it should return "password found" ps. if I use the URI in a browser the result is the same. Link to comment Share on other sites More sharing options...
Fabian Näf Posted May 28, 2018 Share Posted May 28, 2018 Hi Michael I guess the issue is, that you added a PasswordID to your search. Try to remove the ID in your URL ("100") and try again. Best regards, Fabian Link to comment Share on other sites More sharing options...
MichaelRyom Posted May 29, 2018 Share Posted May 29, 2018 Will test it, but the documentation state the at PasswordListID can be use. "https://passwordstate/api/searchpasswords/<PasswordListID>" Link to comment Share on other sites More sharing options...
MichaelRyom Posted May 29, 2018 Share Posted May 29, 2018 So I have been testing and I can find the flaw. Sometimes is works with passwordlistID, sometimes it dont I'm now testing with notes instead of passwordlistID HTTPS://pstate/winapi/searchpasswords/?username=username&title=title¬es=notes Link to comment Share on other sites More sharing options...
support Posted May 29, 2018 Share Posted May 29, 2018 Hi Michael, Can you give us some examples of what's not working for you, and we will look into them? On your last URL provided, you've changed to the Windows Integrated API - was this intentional? Regards Click Studios Link to comment Share on other sites More sharing options...
MichaelRyom Posted May 30, 2018 Share Posted May 30, 2018 I'm using the win API - Only. As I wrote in the beginning: Correctly formatted - Does not return the password Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title" -Credential $cred Returns "[{"errors":[{"message":"Invalid API Call"},{"phrase":"Error = Object reference not set to an instance of an object."}]}]" Incorrectly formatted - Does return msg that there is no password record if I change it to something incorrect like added a "1" after username or title - It tells me there is no record like expected Invoke-WebRequest -Uri "HTTPS://pstate/winapi/searchpasswords/100?username=username&title=title1" -Credential $cred Returns "[{"errors":[{"message":"Not Found"},{"phrase":"You search for Password records return zero results."}]}]" Some more testing: Invoke-WebRequest -URI "https://pstate/winapi/searchpasswords/83" -Credential $cred -ContentType "application/json; charset=utf-16" Returns a list of password for the passwordlist with ID 83 (Invoke-WebRequest -URI "https://pstate/winapi/searchpasswords/83?username=username" -Credential $cred -ContentType "application/json; charset=utf-16") Returns a password list In the first two examples, I would expect the output to be the same if username and/or title was incorrect, just like it does in the second example. When the title is purposely changed by adding a "1" at the end. Link to comment Share on other sites More sharing options...
support Posted May 31, 2018 Share Posted May 31, 2018 Hi MichaelRyom, I've compared your examples to our documentation, and notice a couple of differences which I can confirm in my environment, if I change them, the search functionality works as expected. 1. You are using invoke-webrequest instead of invoke-restmethod 2. You don't have -method GET as a parameter in your API call 3. You are using -Credential $cred instead of -UseDefaultCredentials An example of searching with the changes I've mentioned above would be $PasswordstateUrl = 'https://sandbox.halox.net/winapi/searchpasswords/10929?username=asand' Invoke-RestMethod -Method Get -Uri $PasswordstateUrl -UseDefaultCredentials another example, searching by username and title is: $PasswordstateUrl = 'https://sandbox.halox.net/winapi/searchpasswords/10929?username=asand&title=Admin Linux' Invoke-RestMethod -Method Get -Uri $PasswordstateUrl -UseDefaultCredentials Hope this helps! Support. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now