Ban User returns, 'Missing required parameter "user_id"'

I must be stupid…I’m staring at the user_id and, as far as I know, the syntax is correct. What am I doing wrong here??

const body = {
    "user_id": "9876", //test user
    "duration": 30,
    "reason": "no reason"
}

fetch(timeoutUrl, {
    method: 'POST',
    headers: {
		'Client-ID': 'xxx',
		'Authorization': 'Bearer xxx',
        'Content-Type': 'application/json',
    },
    body: JSON.stringify(body)
}).then(res => res.json())
  .then(json => console.log(json));

Here’s what I get on the response:

{
  error: 'Bad Request',
  status: 400,
  message: 'Missing required parameter "user_id"'
}

I’ve tried putting the user_id in every conceivable combination within the parameters with no luck. Any thoughts? Thank you for your time.

const body = {
    "user_id": "9876", //test user
    "duration": 30,
    "reason": "no reason"
}

Should be

const body = {
    data: {
        "user_id": "9876", //test user
        "duration": 30,
        "reason": "no reason"
    }
}

I’m gonna go put my head in a hole for a bit. Thank you, Barry!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.