Error Using Set-SnipeitAsset
axisfx24 opened this issue · 3 comments
Context
Trying to update an asset, I get a failing error.
DEBUG: Invoke-SnipeitMethod url: https://irvdcsnipeit
DEBUG: {
"order_number": "4"
}
VERBOSE: [Invoke-SnipeitMethod] Invoking method Patch to URI
DEBUG: [Invoke-SnipeitMethod] Invoke-WebRequest with:
Name Value
ErrorAction SilentlyContinue
Headers {Authorization, Accept, Content-Type}
Method Patch
Body {123, 13, 10, 32…}
UseBasicParsing True
Uri https://irvdcsnipeit/api/v1/hardware/60
VERBOSE: PATCH https://irvdcsnipeit/api/v1/hardware/60 with 27-byte payload
VERBOSE: received 1293-byte response of content type text/html
VERBOSE: [Invoke-SnipeitMethod] Failed to get an answer from the server
DEBUG: [Invoke-SnipeitMethod] Executed WebRequest. Access StatusCode: 405, ReasonPhrase: 'Method Not Allowed', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: Microsoft-IIS/10.0
Date: Fri, 22 Oct 2021 22:11:17 GMT
Allow: GET
Allow: HEAD
Allow: OPTIONS
Allow: TRACE
Content-Type: text/html
Content-Length: 1293
} to see details
VERBOSE: [Invoke-SnipeitMethod] Status code: MethodNotAllowed
VERBOSE: StatusCode: 405, ReasonPhrase: 'Method Not Allowed', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: Microsoft-IIS/10.0
Date: Fri, 22 Oct 2021 22:11:17 GMT
Allow: GET
Allow: HEAD
Allow: OPTIONS
Allow: TRACE
Content-Type: text/html
Content-Length: 1293
}
VERBOSE: Status:
VERBOSE: Messages:
VERBOSE: [Invoke-SnipeitMethod] Function ended
Your Environment
- SnipitPS Module version used: 1.10.207
- Operating System and PowerShell version: Win10, PS 7.1.5
- Snipe It version: 5.3.0
Steps to Reproduce (for bugs)
Choosing any field to update, using pipe data from Get-SnipeitAsset, using a variable or static ID, fails with the error above.
Ex: Set-SnipeitAsset -id '60' -order_number '4'
Is this new server setup? Or is have there been some major change iis or php setup?
Quick look to you traces shows that IIS does not allow PATCH request method to /api/v1/hardware/{id}
as it should. All needed methods are listed on following page [Setup Snipe It on IIS] https://snipe-it.readme.io/docs/windowsiis) look at "Enable Additional HTTP verbs for api and frontend usage".
I had the correct verbs in my site config, but updating it for the entire server resolved the issue.
Thank you for the solution.
Nice that you fixed it. Have fun.