PDA

View Full Version : How to POST a NEW THREAD using the Mobile API ?


PleaseHelp
01-30-2012, 06:03 PM
Hello,

How do you POST a NEW THREAD using the Mobile API ?

From what we can tell, you need to use the 'api_m' => 'newthread_postthread' method, but what else do we need to include in that parameter list in order for a new thread to be successfully posted?

Potential candidates include (but are not limited to) :


'forumid' =>
'subject' =>
'message' =>
'posthash' =>
'poststarttime' =>


Please help. Thanks.

PleaseHelp
01-31-2012, 06:15 PM
Anyone?

We still haven't been able to get this to work, no matter which combination of parameters we use for 'api_m' => 'newthread_postthread' .

There is absolutely no documentation on this, so it's just a guessing game and we're all out of guesses.

Please help.

Paul M
01-31-2012, 06:47 PM
I think you are missing 'loggedinuser' - Set it to the ID of current logged-in user. Set to 0 if a guest is posting.

PleaseHelp
01-31-2012, 07:10 PM
I think you are missing 'loggedinuser' - Set it to the ID of current logged-in user. Set to 0 if a guest is posting.Thanks for your reply, but it's still not working.

To be clear, here's what we're doing:

First, we're calling newthread_newthread ("returns new thread form related data") as follows:

array('api_m' => 'newthread_newthread','forumid' => 1, 'loggedinuser' => 1);

Then, we're calling newthread_postthread ("posts new thread") using the posthash and poststarttime provided by newthread_newthread, as follows:

array('api_m' => 'newthread_postthread', 'forumid' => 1, 'subject' => 'Test SUBJECT from the Mobile API', 'message' => 'Test MESSAGE from the Mobile API', 'posthash' => $postHash, 'poststarttime' => $postStartTime, 'loggedinuser' => 1);

However, instead of posting the thread, we're getting the following return data (notice the "invalid posthash" under [newpost] and the 'nosubject' under the [postpreview] errorlist):

Array
(
[response] => Array
(
[attachmentoption] => Array
(
[posthash] => d78ce48039f1bcbb9f8a5a11e38607fc
[contentid] => 0
[poststarttime] => 1328039824
[attachuserid] => 1
[contenttypeid] => 1
)

[disablesmiliesoption] => Array
(
[checked] => Array
(
[parseurl] =>
[disablesmilies] =>
[signature] =>
[postpoll] =>
[receipt] =>
[savecopy] =>
[stickunstick] =>
[openclose] =>
[sendanyway] =>
[rate] =>
[subscribe] =>
)

)

[emailchecked] => Array
(
[0] => 1
)

[explicitchecked] =>
[foruminfo] => Array
(
[forumid] => 1
[title] => Test Forum
[description] =>
[title_clean] => Test Forum
[description_clean] =>
)

[forumrules] => Array
(
=>
[can] => Array
(
[postnew] => 1
[replyown] => 1
[replyothers] => 1
[reply] => 1
[editpost] => 128
[postattachment] => 1
[attachment] => 1
)

[htmlcodeon] =>
[imgcodeon] =>
[smilieson] =>
)

[human_verify] =>
[newpost] => Array
(
[message] =>
[title] =>
[iconid] => 0
[prefixid] =>
[taglist] =>
[parseurl] => 0
[signature] => 0
[preview] =>
[disablesmilies] => 0
[rating] => 0
[username] =>
[postpoll] => 0
[polloptions] => 0
[folderid] => 0
[humanverify] => Array
(
)

[poststarttime] => 0
[B] [posthash] => invalid posthash
[stickunstick] => 0
[openclose] => 0
[podcasturl] =>
[podcastsize] => 0
[podcastexplicit] => 0
[podcastkeywords] =>
[podcastsubtitle] =>
[podcastauthor] =>
[subscribe] => 0
[htmlstate] => on_nl2br
[emailupdate] => 9999
[enablesmilies] => 1
[visible] => 1
)

[podcastauthor] =>
[podcastkeywords] =>
[podcastsize] =>
[podcastsubtitle] =>
[podcasturl] =>
[polloptions] => 0
[posthash] => d78ce48039f1bcbb9f8a5a11e38607fc
[posticons] => Array
(
[iconchecked] => 1
[posticonbits] => Array
(
[0] => Array
(
[alttext] => Post
[iconchecked] =>
[iconid] => 1
[iconpath] => images/icons/icon1.png
)

[1] => Array
(
[alttext] => Thumbs down
[iconchecked] =>
[iconid] => 13
[iconpath] => images/icons/icon13.png
)

[2] => Array
(
[alttext] => Wink
[iconchecked] =>
[iconid] => 12
[iconpath] => images/icons/icon12.png
)

[3] => Array
(
[alttext] => Red face
[iconchecked] =>
[iconid] => 11
[iconpath] => images/icons/icon11.png
)

[4] => Array
(
[alttext] => Talking
[iconchecked] =>
[iconid] => 10
[iconpath] => images/icons/icon10.png
)

[5] => Array
(
[alttext] => Unhappy
[iconchecked] =>
[iconid] => 9
[iconpath] => images/icons/icon9.png
)

[6] => Array
(
[alttext] => Angry
[iconchecked] =>
[iconid] => 8
[iconpath] => images/icons/icon8.png
)

[7] => Array
(
[alttext] => Smile
[iconchecked] =>
[iconid] => 7
[iconpath] => images/icons/icon7.png
)

[8] => Array
(
[alttext] => Cool
[iconchecked] =>
[iconid] => 6
[iconpath] => images/icons/icon6.png
)

[9] => Array
(
[alttext] => Question
[iconchecked] =>
[iconid] => 5
[iconpath] => images/icons/icon5.png
)

[10] => Array
(
[alttext] => Exclamation
[iconchecked] =>
[iconid] => 4
[iconpath] => images/icons/icon4.png
)

[11] => Array
(
[alttext] => Lightbulb
[iconchecked] =>
[iconid] => 3
[iconpath] => images/icons/icon3.png
)

[12] => Array
(
[alttext] => Arrow
[iconchecked] =>
[iconid] => 2
[iconpath] => images/icons/icon2.png
)

[13] => Array
(
[alttext] => Thumbs up
[iconchecked] =>
[iconid] => 14
[iconpath] => images/icons/icon14.png
)

)

[remainingspan] => 0
)

[postpreview] => Array
(
[errorlist] => Array
(
[0] => Array
(
[errormessage] => Array
(
[0] => nosubject
)

)

[1] => Array
(
[errormessage] => Array
(
[0] => tooshort
[1] => 1
)

)

)

[newpost] =>
[post] =>
[previewmessage] =>
)

[poststarttime] => 1328039824
[prefix_options] =>
[selectedicon] => Array
(
[src] => clear.gif
[alt] =>
)

[subject] =>
[tags_remain] => 25
[tag_delimiters] =>
)

[vboptions] => Array
(
[postminchars] => 1
[titlemaxchars] => 100
[maxpolloptions] => 0
)

[show] => Array
(
[tag_option] => 1
[posticons] => 1
[smiliebox] => 1
[attach] => 1
[openclose] => 1
[stickunstick] => 1
[closethread] => 1
[unstickthread] => 0
[subscribefolders] => 0
[parseurl] => 1
[misc_options] => 1
[additional_options] => 1
[poll] => 1
[podcasturl] => 0
[tags_remain] => 1
)

)


Any ideas what we're doing wrong and how to fix it?

Thanks.

Paul M
02-01-2012, 02:26 AM
You can get away with just calling newthread_postthread direct, with only forumid, message & subject.

I believe your issue is that you are sending them as a GET request, you must send them as a POST request.

PleaseHelp
02-02-2012, 07:16 PM
You can get away with just calling newthread_postthread direct, with only forumid, message & subject.

I believe your issue is that you are sending them as a GET request, you must send them as a POST request.Thank you, Paul.