borderemy@gmail.Com Posted March 16, 2019 Share Posted March 16, 2019 Hi, I tried to update some field with api, i use this command but powershell tell me some error with Put Method # PowerShell Request #JSON data for the object $jsonData = ' { "PasswordID":"46411", "password":"JENN-ZHn#3+A^yc", "APIKey":"<apikey>" } ' $PasswordstateUrl = 'https://passwordstate/api/passwords' $result = Invoke-Restmethod -Method Put -Uri $PasswordstateUrl -ContentType "application/json" -Body $jsonData Can you tell me how updating some field (like "notes" or "custom field"...) Thanks and sorry for english... Link to comment Share on other sites More sharing options...
support Posted March 16, 2019 Share Posted March 16, 2019 Hello, You just need to add in the extra fields into this jsonObject, like below" $jsonData = ' { "PasswordID":"46411", "password":"JENN-ZHn#3+A^yc", "Notes":"Notes 123", "GenericField1":"custom field data", "APIKey":"<apikey>" } ' We hope this helps. Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 17, 2019 Author Share Posted March 17, 2019 I try this but powshell didn't reconnize the put method. $result = Invoke-Restmethod -Method Put -Uri $PasswordstateUrl -ContentType "application/json" -Body $jsonData Thanks for your help Link to comment Share on other sites More sharing options...
support Posted March 17, 2019 Share Posted March 17, 2019 Hi, You might need to google the actual error for this, as PowerShell does support the Put method - we use it all the time, as well as other customers as well. Unless you have some load balancers or proxy servers which are causing issues with this? Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 17, 2019 Author Share Posted March 17, 2019 I try to search in Google but cant find anything + ... $result = Invoke-Restmethod -Method Put -Uri $PasswordstateUrl -Con ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation : (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand Link to comment Share on other sites More sharing options...
support Posted March 17, 2019 Share Posted March 17, 2019 Hello, Could you post the full error and script - I do not see anything in there which says PUT is not allowed? Can you also confirm what version of PowerShell you are executing the script from? Thanks Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 17, 2019 Author Share Posted March 17, 2019 Script # PowerShell Request #JSON data for the object $jsonData = ' { "PasswordID":"94", "password":"JENN-ZHn#3+A^yc", "APIKey":"<apikey>" } ' $PasswordstateUrl = 'https://myurl/api/passwords' $result = Invoke-Restmethod -Method Put -Uri $PasswordstateUrl -ContentType "application/json" -Body $jsonData Powershell version Name Value ---- ----- PSVersion 5.1.17134.590 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17134.590 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 Link to comment Share on other sites More sharing options...
support Posted March 17, 2019 Share Posted March 17, 2019 Thanks, can you also post the full error as well please - unless that was the full error above? Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 17, 2019 Author Share Posted March 17, 2019 Don't have better than that : Invoke-Restmethod : La page que vous recherchez ne peut pas être affichée, car une méthode non valide (verbe HTTP) est utilisée. Au caractère Ligne:13 : 15 + ... $result = Invoke-Restmethod -Method Put -Uri $PasswordstateUrl -Con ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation : (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand Link to comment Share on other sites More sharing options...
support Posted March 17, 2019 Share Posted March 17, 2019 Thanks. Is your Passwordstate URL direct to the web server, and not going through a Proxy Server or Load Balancer? Something is rejecting this API Call, and it would not be Passwordstate as it is core functionality for the API. Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 17, 2019 Author Share Posted March 17, 2019 His directly connect to the Web and script for add password works great... Juste some issue with the "put" method not the "post" Link to comment Share on other sites More sharing options...
support Posted March 17, 2019 Share Posted March 17, 2019 Hello, We're not sure what else to suggest sorry - all verbs (GET, POST, PUT, DELETE) should be working. Are you hosting Passwordstate yourself, or is it hosted in the cloud? Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 18, 2019 Author Share Posted March 18, 2019 Can i send you my API key for test ? I'm hosting myself Link to comment Share on other sites More sharing options...
support Posted March 18, 2019 Share Posted March 18, 2019 Hello, API Keys are independent for every install of Passwordstate - so web cannot test with it sorry. But if your POST and GET requests are working with this API key, then the issue is not related to this. Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 19, 2019 Author Share Posted March 19, 2019 I send you a private message with my informations, can you try to update my field ? Link to comment Share on other sites More sharing options...
support Posted March 19, 2019 Share Posted March 19, 2019 Hello, I just replied to your message - same error as you sorry. Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 19, 2019 Author Share Posted March 19, 2019 Does i need to change something in IIS like this: Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted March 19, 2019 Author Share Posted March 19, 2019 For your information and Feedback http://evolutionarydeveloper.blogspot.com/2012/07/method-not-allowed-405-on-iis7-website.html Put method was not allow on my IIS server... Link to comment Share on other sites More sharing options...
support Posted March 19, 2019 Share Posted March 19, 2019 Hello, Each of these Handler Mappings have different settings, so I'm not sure which one you've selected in your screenshot to compare against? If you want, you can follow these instructions for moving your install of Passwordstate, in case there are issues with your IIS configuration - I wish we could tell you the cause of this, but we're simply not sure sorry. https://www.clickstudios.com.au/documentation/move-new-web-server.aspx https://www.clickstudios.com.au/documentation/move-new-database-server.aspx Regards Click Studios Link to comment Share on other sites More sharing options...
borderemy@gmail.Com Posted April 10, 2019 Author Share Posted April 10, 2019 Hello I have again the same probleme, and the solution don't works this time. My IIS Server don't allow the PUT method for update password. Can you tell me how allow PUT method ? Thx Link to comment Share on other sites More sharing options...
support Posted April 10, 2019 Share Posted April 10, 2019 Hello, Sorry, we're not sure where in IIS you are seeing this restriction, but it is not a default setting for IIS. If you cannot move you install to a new web server, could you please log a support call with Microsoft and they might be able to help you with this - we're simply not sure sorry. Regards Click Studios Link to comment Share on other sites More sharing options...
mag Posted January 20, 2021 Share Posted January 20, 2021 Hiya! I found this thread while troubleshooting the same problem so I thought I'd add what ended up working for me: I'm running Windows Server 2016, and apparently there is a "feature" called WebDAV that often filters PUT requests, even if you disable it! I ended up having to fully remove it. To do this: Open Server Manager and in the upper right go to Manage > Remove Roles And Features WebDAV can be found under Web Server (IIS) > Web Server > Common HTTP Features > WebDAV Publishing. Once it is uninstalled, you will have to reboot the server (not just restart IIS, sadly). Hope this helps someone! Link to comment Share on other sites More sharing options...
support Posted January 21, 2021 Share Posted January 21, 2021 Hi Mag, Thanks very much for sharing this information, as we have never come across the use of WebDAV in the past. Regards Click Studios 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