Error when generating a master token on 1.15.5
-
@baris said in Error when generating a master token on 1.15.5:
cant save settings on /admin/settings/api · Issue #9065 · NodeBB/NodeBB
cold load /admin page navigate to /admin/settings/api clicking save results in error 2020-12-05T19:35:50.745Z [4567/16048] - error: admin.config.setMultiple MongoError: '$set' is empty. You must specify a field like so: {$set: {: ...
GitHub (github.com)
Thanks @baris for solving it quickly. Do you know why the following curl call returns "Forbidden" when I try to use master token from above page for this endpoint https://docs.nodebb.org/api/write.html#tag/topics/paths/~1topics~1{tid}~1tags/put.
curl -X PUT "https://forum/api/v3/topics/367/tags" -H 'Content-Type: application/json' -H 'Authorization: Bearer cd0a4d35-c5a2-4e03-94fb-c95bf6ff1a8d' -H 'Cookie: __cfduid=dae694b4b6e86d48e30425724b0534c2e1605297679; express.sid=s%3Acrh2H3AV5Z29UOdXC0uA8Nx2eiGyShkD.CfZz7WGVTF9Y5YMUlq5v1i1ObuQkD4fUP1OM4wnOS20; _csrf=F3fobS4lIe5sJFkcd5L_NfXW' --data-raw '{"tags":"visit", "_uid":"1"}'
Interestingly when i call https://forum/api/v2/topics/367/tags with same payload using a token from write api plugin it returns following but no tags get added through that too.
{"code":"ok","payload":{}}
-
@julian said in Error when generating a master token on 1.15.5:
--data "property=value"
@julian Even with fewer options it returns the same but tags are not added on the topic.
curl -X PUT "https://forum/api/v3/topics/367/tags" -H 'Authorization: Bearer ffee84f8-2afd-4ab5-91d6-b57afa6a2025' --data "tags=visit&_uid=1"
Returns
{"status":{"code":"ok","message":"OK"},"response":{}} -
@julian Seems to do the trick. Thanks for the pointer.
For others if you are passing multiple tags through curl here is a working example.
curl --location --request PUT 'https://forum.com/api/v3/topics/14/tags' --header 'Authorization: Bearer ffee84f8-2afd-4ab5-91d6-b57afa12a2025' --data-urlencode 'tags[]=visit' --data-urlencode 'tags[]=cambodia' --data-urlencode '_uid=1'