Attribute naming camel case vs sentence case

I’m trying to use /asset/attributes to write an attribute value (I plan to update multiple at once, but I’m starting small) and even if my service user has full read and write access, I still get an INSUFFICIENT_ACCESS failure:

[
  {
    "ref": {
      "id": "5aIo6dNtC7jlvUzKsfZMlh",
      "name": "Battery"
    },
    "failure": "INSUFFICIENT_ACCESS"
  }
]

My original message is, for example:

[
  {
    "ref": {
      "id": "5aIo6dNtC7jlvUzKsfZMlh",
      "name": "Battery"
    },
    "value": 35,
    "deleted": false
  }
]

Am I using this correctly? It seems pretty intuitive… I assume id is that of the asset and name is that of the asset’s attribute, which I’m trying to set to the number specified by value. Does that look right?

I think I’ve solved my own question! :laughing:

Turns out that in view mode, the attribute is displayed capitalised:

image

whereas in edit mode, it’s displayed with a lower case b. I would show you, but I’m a newbie on this forum so I’m not allowed.

If I change my request to have a lower case b for battery, it works!

What an unusual way for me to trip up!

I can see how this is confusing; in view mode we try and show friendly sentence case labels rather than camel case (which is more typically how attribute names are written).

Will make sure we have an issue to try and improve this in the future.

1 Like

Thanks for the reply. Perhaps when creating attributes, there could be some guidance if you don’t follow the convention, with a suggestion of how to fix it?

By the way, whilst the new, edited title does now relate to the root cause, it no longer reflects the issue I was having. I wonder if it will make it harder for others with the same issue to find this thread. When searching for solutions to the problem I was having, if I’d seen a thread called “Attribute naming camel case vs sentence case”, I would almost certainly have ignored it as it sounds unrelated!

1 Like

The least would be to add a helper text in the add attribute dialog indeed.
Any ideas to further improve this are welcome!

I was wondering about using a camelCase regular expression to detect “compliance”, displaying a message if the pattern doesn’t match.