Quick question about the PUT /api/v2/scripts/agents/{agentId} endpoint in our multi-org deployment. The call returns a 400 Bad Request when attempting to set the scriptStatus to COMPLETE via the platform api.
{“code”:“bad.request”,“message”:“Invalid script status transition”}
The agent is currently in PAUSED state. Should this transition be allowed? We are using SDK v1.12.0. Any insights on valid state machines for partner integrations would be appreciated.
It depends, but typically the state machine does not allow jumping directly from PAUSED to COMPLETE. The system usually requires an ACTIVE or RUNNING state before finalizing. Check the script definition for mandatory transitions. In my JMeter load tests, skipping steps causes immediate 400 errors due to validation logic. Verify the allowed transitions in the docs.
This looks like a state machine validation error. The suggestion above is correct, but automation often needs explicit handling.
- Query
GET /api/v2/scripts/agents/{agentId} to verify current status.
- Send
PUT with scriptStatus: "ACTIVE" first.
- Wait for async completion, then send
PUT with scriptStatus: "COMPLETE".
Direct jumps are rejected by the API.