Invoke-RestMethod -Method Post -Uri $API_URL -Headers $Headers -Body $body
Das Problem ist, dass er es nicht schafft das Label anzulegen. Dort kommt die Fehlermeldung:
Invoke-RestMethod : {“title”: “Bad Request”, “status”: 400, “detail”: “These fields have problems: attributes”, “fields”: {“attributes”: {“labels”: [“Not a valid string.”]}}}
Führe ich das Script ohne die Zeilen des Label hinzufügen aus, wird der Host fehlerfrei angelegt.
hast du es mal mit einem anderen Label, z.B. { “test”: “test1” } versucht? Vielleicht kann die API nicht mit “_” umgehen. Bei mir funktioniert es, mit :
Hallo Lars,
Labels funktionieren auch mit “_”. Ich habe mir Deinen Code aus dem Forum kopiert - musste dann ein paar " Zeichen ändern und dann konnte ich die Aktion in der interaktiven REST-API GUI problemlos ausführen. Das hat funktioniert:
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.