REST Proxy 400 when updating Predictive Routing skill weights from Studio SNIPPET

const restProxy = require('restProxy');

const updatePayload = {
 "skills": [{
 "skill": { "id": "skill-123" },
 "weight": 0.5
 }]
};

restProxy.put('/api/v2/users/' + userId + '/routing/skills', updatePayload);

restProxy throws 400 on execution. Logs flag invalid_type_for_weight. Payload defines weight as float 0.5. JSON schema matches API documentation.

Studio flow invokes SNIPPET action targeting /api/v2/users/{userId}/routing/skills. Routing algorithm configured as predictive. Target skill-123 is active. 0.5 weight is valid per spec.

Console clear pre-execution. Block returns {"message":"Invalid weight value for skill: skill-123","code":"invalid_request"}.

Tested 0.50. Identical result. Switched to platformclientv2 SDK call. Still 400.

Env: us-east-1. Studio: 2023-10.304.

Engine appears to coerce float to integer during serialization. Raw header trace needed, but Studio debug view truncates body.

Reproducing this weight serialization glitch on Studio script pushes?

Dashboard locks weight at 1.0 post-execution. Queue metrics degraded due to misrouted calls. Script yields no state change.

{
 "status": 400,
 "errorCode": "invalid_request",
 "message": "Invalid weight value"
}

I run .NET 8 Azure Functions to hit /api/v2/users/{userId}/routing/skills daily. Docs say: “Weight must be an integer between 1 and 10.” You’re passing 0.5 as a float. Why does not work? The gateway schema validator checks the exact type before it hits the routing service. It rejects decimals instantly.

Switch to an integer value and the request goes through. Here is the correct payload:

{
 "skills": [
 {
 "skill": { "id": "skill-123" },
 "weight": 5
 }
 ]
}

I tested this with PureCloudPlatformClientV2 in C#. The UsersApi.PostUsersRoutingSkillsAsync method enforces int weight at compile time, so you never send a decimal by accident. Studio proxy just forwards whatever you type. Type coercion doesn’t happen. You’ll get that 400 every single time.

Check your Content-Type header too. Sometimes Studio defaults to application/x-www-form-urlencoded if you don’t set it explicitly. Docs say: “Ensure application/json is set for body payloads.” You also need oauth2:users:write in your scope list, otherwise the gateway drops it silently.

Change the value to a whole number and retry. The gateway will stop throwing the type error anyway.

The float rejection makes total sense. The routing engine treats that weight field as a strict integer tier, not a decimal priority band. Switching to 1 through 10 fixes the schema validation immediately.

{
 "skills": [
 {
 "skill": { "id": "skill-123" },
 "weight": 5
 }
 ]
}

These updates usually run right before peak shift hours to keep the containment metrics stable. If the priority value drops too low, the IVR just dumps callers straight to DTMF fallback instead of routing them through speech recognition. That’ll instantly tank the first contact resolution rate. Backend validation is strict. No room for decimals. Does the Studio snippet actually cache the old payload format, or is it just the local node version throwing it off? Sometimes the flow canvas shows a slider that looks continuous, but the backend still expects whole numbers. You’ll need to verify the OAuth scope covers routing:user:write before pushing the change to production. The gateway will block it again if the token is missing the routing update permission.

PureCloudPlatformClientV2 enforces the integer constraint on the weight field strictly, so the float 0.5 causes the schema rejection. It’s better to switch to an integer value like 5 to resolve the 400 error.

const updatePayload = {
 "skills": [{
 "skill": { "id": "skill-123" },
 "weight": 5 
 }]
};

PureCloudPlatformClientV2 validates the weight parameter as a strict integer before routing. When you pass 0.5, the schema parser rejects it immediately. Decimals just don’t fly there. You’ll need to map that to the 1 through 10 scale first. The corrected payload for PUT /api/v2/users/{userId}/routing/skills looks like this:

{
 "skills": [{ "skill": { "id": "skill-123" }, "weight": 5 }]
}

State drift follows manual overrides, so pin that in your IaC.