powershellwrapper icon indicating copy to clipboard operation
powershellwrapper copied to clipboard

New-ITGlueFlexibleAssets can't find route for bulk add

Open LastElf opened this issue 2 years ago • 0 comments

Steps to reproduce

Seems to be the same as #92 I have a System.Collections.Generic.List object with two flexible assets in it. Using the conversion depth I get this output:

[ { "type": "flexible-assets", "attributes": { "flexible_asset_type_id": <obsf>, "traits": { "trait1": value1, "trait2": "value2" }, "organization_id": <obsf> } }, { "type": "flexible-assets", "attributes": { "flexible_asset_type_id": <obsf>, "traits": { "trait1": value1, "trait2": "value2" }, "organization_id": <obsf> } } ]

I pass this through with New-ITGlueFlexibleAssets -data $list

Expected behavior

New objects get created

Actual behavior

Returns error: New-ITGlueFlexibleAssets: {"errors":[{"status":422,"title":"bulk action not allowed for Flexible Asset using this route","source":{"pointer":"data"}}]}

Using this with the exact same list does work, but makes too many API calls for my liking: foreach ($object in $list) {New-ITGlueFlexibleAssets -data $object}

I have also tried @($list[0],$list[1]) just to sanity check it isn't something weird with the List type.

Environment

Please share additional details about your environment. Version information for:

  • PowerShell 5 or 7
  • ITGlueAPI 2.1.0
  • Operating System Win11

LastElf avatar Sep 05 '22 07:09 LastElf