Try to post using API (and failing)
Solved
Technical Support
-
Hi,
I'm trying to post using the API, and have this
curl -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" -H "Authorization: Bearer (token - redacted)" --data "title=This is an API test" --data "content=This is an API test" --data "cid=1" https://phenomlab.com/api/v2/topics
This in turn provides the below output
{"code":"params-missing","message":"Something was wrong with the request payload you passed in. | Required parameters were missing from this API call, please see the \"params\" property","params":{"0":"_uid"}}
What am I doing wrong here ?
Thanks
-
Looks like you must provide the
"_uid"
parameter -
@pitaj Thanks, but even this doesn't seem to work
curl --location --request POST 'https://phenomlab.com/api/v2/topics/' --header 'Authorization: Bearer (token redacted)' --header 'Content-Type: application/json' --data-raw '{ "content": "This is a test post", "title": "This is a test post", "tags": ["testing"] }'
Results in
<div class="alert alert-danger"> <strong>[[global:500.title]]</strong> <p>[[global:500.message]]</p> <p>/api/v2/topics</p> <p>Unexpected token t in JSON at position 0</p> </div>
-
-
Try this:
curl --location --request POST 'http://localhost:4567/api/v3/topics' \ --header 'Authorization: Bearer TOKEN' \ --header 'Content-Type: application/json' \ --data-raw '{ "cid": 1, "title": "Test topic", "content": "This is the test topic content", "tags": [ "test", "topic" ], "_uid": 1 }'
Copyright © 2024 NodeBB | Contributors