christaylorcodes / ConnectWiseManageAPI

PowerShell wrapper for the ConnectWise Manage REST API
MIT License
108 stars 61 forks source link

Update-CWMProductCatalog recurringFlag MissingRequiredField #53

Open kgarbet opened 9 months ago

kgarbet commented 9 months ago

Hello,

I'm attempting to run: Update-CWMProductCatalog -id $CWProductCreated.id -Operation replace -Path recurringFlag -Value True

When i run this, i get an error:

Invoke-CWMWebRequest : An exception has been thrown. --> The remote server returned an error: (400) Bad Request. An error has been thrown. --> --> { "code": "InvalidObject", "message": "catalogItem object is invalid", "errors": [ { "code": "MissingRequiredField", "message": "recurringBillCycle or recurringOneTimeFlag is required.", "resource": "catalogItem", "field": "recurringOneTimeFlag" }, { "code": "MissingRequiredField", "message": "recurringBillCycle or recurringOneTimeFlag is required.", "resource": "catalogItem", "field": "recurringBillCycle/id" } ] }

Running these two command together doesn't work. I feel like I need to do them both in one command? Update-CWMProductCatalog -id $CWProductCreated.id -Operation replace -Path 'recurringBillCycle' -Value @{'id' = '2'} Update-CWMProductCatalog -id $CWProductCreated.id -Operation replace -Path recurringFlag -Value True

Am I right in thinking they need to be run together, is that even possible? or am I doing this the complete wrong way?

damiankw commented 1 month ago

Hey @kgarbet, did you end up getting this to work? I'm running into the same issue and have found a workaround, but I had to change some of the Private functions to make it happen.