vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to POST a NEW THREAD using the Mobile API ? (https://vborg.vbsupport.ru/showthread.php?t=277788)

PleaseHelp 01-30-2012 06:03 PM

How to POST a NEW THREAD using the Mobile API ?
 
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

Quote:

Originally Posted by Paul M (Post 2294702)
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:

Code:

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:

Code:

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):

Code:

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
                (
                    [bbcodeon] =>
                    [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
                  [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

Quote:

Originally Posted by Paul M (Post 2294835)
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.


All times are GMT. The time now is 05:31 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01460 seconds
  • Memory Usage 1,808KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete