I'm trying to write a Python API wrapper over the NodeBB REST API but I'm a little confused by the interface. I understand that you can add /api
to most if not all urls and be able to get json response.
"https://community.nodebb.org/user/truetuna"
"https://community.nodebb.org/api/user/truetuna"
However, I'd prefer to reference a resource by their id
rather than the associated username, topic name, category name etc.
For example,
# My username vs my uid.
"https://community.nodebb.org/api/user/truetuna"
"https://community.nodebb.org/api/user/6166"
I ask because it seems like there's quite a split between the read-api and the write-api provided by the nodebb-plugin-write-api
plugin. For example, if I wanted to PUT
to a user, I have to reference the resource via the uid
, but when I want to GET
a user, I need to use their username
.
It's not too bad when it's the user resource but it gets pretty weird when it comes to say, topics. With topics, I need the tid
AND the topic title
. In addition, the topic title needs to be formatted in a specific way (removing commas, lowercase, replacing spaces with hyphens etc.).
# The original title was "Deleted topics, comments"
"https://community.nodebb.org/api/topic/6438/deleted-topics-comments"
"https://community.nodebb.org/api/topic/6438/"
It's very confusing and it makes it quite difficult to use the API.
Am I missing something? Is it possible to reference resources just by their id? Is there a switch I need to turn on in the ACP for this to work? Is there a piece of documentation I'm missing?
Because ideally, I'd prefer to only have to use the id as the resource reference, e.g.
PUT, DELETE "https://community.nodebb.org/api/topic/6438/"
PUT, DELETE "https://community.nodebb.org/api/user/6438/"
PUT, DELETE "https://community.nodebb.org/api/category/6438/"
...
Thanks
PS. I'm using NodeBB v0.7.3