API error 1003 "Malformed JSON in request body" PATCH settings/ssl_recommender

Hi there! Looks like I’m doing everything right but I’m getting the same error again and again
I’m trying to make this PATCH request

I tried with

{
    "value": {
        "id": "ssl_recommender",
        "enabled": "true"
    }
}
{
    "value": {
        "id": "ssl_recommender",
        "enabled": true
    }
}
{
    "id": "ssl_recommender",
    "enabled": true
}
{
    "id": "ssl_recommender",
    "enabled": "true"
}
{
    "value": "{\"id\": \"ssl_recommender\", \"enabled\": true}"
}
{
    "value": "{\"id\": \"ssl_recommender\", \"enabled\": \"true\"}"
}

and none of this is working
every time I get

{
    "success": false,
    "errors": [
        1003
    ],
    "messages": [
        "Malformed JSON in request body"
    ],
    "result": null
}

Have anyone faced this issue before? Maybe anyone knows how to fix that?

You were so so close, you just need this:

{
    "enabled": true
}

The API Docs are sadly a bit of a sore spot, although they’re working on making some of the schemas better. You can give feedback in the bottom left corner. Often times the best way to understand how something works is just to do the action in the dashboard with Dev Tools → Network tab open. It uses the same API for most actions (although it uses https://dash.cloudflare.com/api/ instead of https://api.cloudflare.com/client/ root path), with the same contents. I figured out the right body for that endpoint using just that.

1 Like

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