Can't create the custom capability

I just created this account but I’m not new to this community and ST. Recently I got some time and re-wrote my previous custom DTH in Lua - it works great. I really like the local execution - Samsung did a great and right thing!

However, one issue is that I can’t create any custom capability. It always returns a 403 error, either in the CLI or through API. I can use the custom capabilities created by the others without any issue. Did anyone have the similar problem? The ‘403’ looks like a permission issue. I raised a support ticket to the Smartthings app, but the support guy asked me to raise this issue in the Community.

? Capability Name: Test
? Select an action… Add an attribute
? Attribute Name: test
? Select an attribute type: integer
? Minimum value (default: no minimum):
? Maximum value (default: no maximum):
? Unit of measure (default: none):
? Add a setter command for this attribute? Yes
? If you want to add a basic command, enter a command name now (or hit enter for none):
(Basic commands are simple commands that set the attribute to a specific value.)
? Select an action… Finish & Create
Error: Request failed with status code 403

Hey, @junliu

Maybe your token is out-of-date or CLI-generated tokens are failing somehow. I’m quite sure that you should be fine with a full-scope token from Here.

1 Like

Thanks @erickv
I tried to login/logout the CLI several times, and also created the token in the Smartthings account portal with all the permissions, but still got the same error.

That’s weird…
A good option to see if the issue is in the CLI or your permissions is making this request directly to the ST API, for this, you need a REST API client, like Postman.
Once you have this client, you need to:

  1. Start a POST request, set in the Authorization tab, the PAT as a Bearer Token
  2. Copy the capability endpoint URL for the request (https://api.smartthings.com/v1/capabilities)
  3. Enter the body of your request. I got this structure based on your answers in the CLI, it is the basic one, so you can modify the attribute and setter names if you want.
{
    "name": "Test",
    "attributes": {
        "test": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setTest",
            "enumCommands": []
        }
    },
    "commands": {
        "setTest": {
            "name": "setTest",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "integer"
                    }
                }
            ]
        }
    }
}

Note: Remember to select the corresponding data type for the body, in this case, it’s JSON
4. Execute the request and check the result code.
Here is an example of the request:

Thanks @nayelyz

Yep - I used the API as well, and got the same error. Just did it again with a newly created full permission token - the same 403 error.

Ok, I’ll raise a report for the engineering team about this issue.
Can you send me through a direct message the email account where you created the PAT and are trying to create the capability, please?

Thank you! Just sent it to you.

Thank you for the information. I already reported the issue to the engineering team, as soon as I get an update, I’ll share it with you.

1 Like