Hi! @PitaJ thank you for the quick reply.
I understand that an absolute URL have the protocol, but most of the normal users, at least in our forums, don't know what that is, some use it just because the copied from the browser, but sometimes a user doesn't add it, and having that links as relative URL returns a 404, causing a bad experience.
Some CMS have a sanity check like Django and WordPress if you add a link inside a WordPress, they check if it's another domain and adds the protocol, so the user doesn't have to add it.
I think it's a good measure to prevent bad user experience.
Solved Try to post using API (and failing)
-
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
-
Scrap that - it arrived, but didn't show on the unread counter, which is not what I expected
-
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>
-
Hmm - this seems to work
--data-raw '{ > "cid":"1", > "content": "This is a test post", > "title": "This is a test post", > "tags": ["testing"], > "_uid":"1" > }'
Although I do not see the new topic anywhere ?
-
Scrap that - it arrived, but didn't show on the unread counter, which is not what I expected
-
This post is deleted! -
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 }'
-
@antosik I got it working yesterday, but thanks for this - very useful for someone else looking for the same
-
@phenomlab oh, okay ^^"
The question currently marked as unsolved