I am trying to use Zapier to read the RSS of my publishing site so that I can automatically updates to an existing discussion on Flarum. I couldn't find clear examples in the wild beyond https://discuss.flarum.org/d/6236-are-rest-apis-available-for-this-use-case/7
According to the linked thread, it seems that the JSON format to create a new discussion is something like this. Please correct me if I got the structure wrong. It was reverse engineered from the PHP.
// Url: flarum.com/api/discussions
// Headers
Content-Type: application/json
Accept: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxx; userId=1
{
"data": [
"type": "discussions",
"attributes": {
"title": "the article title",
"content": "the content body"
},
"relationships": {
"tags": {
"data": [
{"type": "tags", "id": "3"}
]
}
}
]
}
But what I actually need is to create a post in an existing discussion. If I could take a guess, I would think that the JSON would look something like this:
// Url: flarum.com/api/posts
// Headers
Content-Type: application/json
Accept: application/json
Authorization: Token xxxxxxxxxxxxxxxxxxxx; userId=1
{
"data": [
"type": "posts",
"attributes": {
"content": "the post content"
},
"relationships": {
"tags": {
"data": [
{"type": "discussions", "id": "3"}
]
}
}
]
}
Could someone direct me or create an example of the JSON format I need to create a post in an existing discussion? I would prefer to run this through an expert before trying it on Zapier.
*Further to this question. Is the post content sent via JSON processed by the Markdown extension?
EDIT: Amended to reflect @sledov's correction.