Advertisement:

Author Topic: SMF 2.0 "REST" API  (Read 120891 times)

Offline wbros

  • Newbie
  • *
  • Posts: 1
Re: SMF 2.0 "REST" API Bug on create post
« Reply #80 on: April 20, 2016, 10:39:34 AM »
On SmfRestClient.php have a big bug on create post:

protected function create_post()
    {
        try {
            $this->loadSSI();
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
        global $sourcedir;
        require_once($sourcedir . "/Subs-Post.php");

        $this->msgOptions = unserialize($this->msgOptions);
        $this->topicOptions = unserialize($this->topicOptions);
        $this->posterOptions = unserialize($this->posterOptions);

        if (!isset($topicOptions['board']) || !isset($msgOptions['subject']) || !isset($msgOptions['body'])) {
           $this->data = 'false';
        } else {
            $this->data = createPost($this->msgOptions, $this->topicOptions, $this->posterOptions);
        }
    }
You use $topicOptions, $msgOptions without $this reference. Always is "false".

Please, change this to:

if (!isset($this->topicOptions['board']) || !isset($this->msgOptions['subject']) || !isset($this->msgOptions['body'])) { $this->data = 'false';

Offline andrejpod

  • Newbie
  • *
  • Posts: 2
Re: SMF 2.0 "REST" API
« Reply #81 on: June 29, 2016, 04:34:33 AM »
Hello,

it would be really nice to present REST api as a connection to arbitrary platform, that is to document the raw REST interface for example to use it in Ror, Java or .Net.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,342
  • Gender: Male
    • Kindred-999 on GitHub
Re: SMF 2.0 "REST" API
« Reply #82 on: July 01, 2016, 06:35:18 PM »
Sure.. go ahead and get that started....
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline andrejpod

  • Newbie
  • *
  • Posts: 2
Re: SMF 2.0 "REST" API
« Reply #83 on: July 12, 2016, 08:16:04 AM »
Can you please give me a raw example of registering a member through a HTTP post with username, password and email?

So in the form of HTTP get/post on

<smf_forum>/api/register/member?secretkey=foo&user=uname&pass=pwd&email=a@b.net

is something like this possible?
« Last Edit: July 12, 2016, 08:56:26 AM by andrejpod »

Offline Geekologist

  • Newbie
  • *
  • Posts: 1
Re: SMF 2.0 "REST" API
« Reply #84 on: May 14, 2017, 02:14:03 PM »
$result = $api->send_pm(array("to" => array(1)), "test", "test", 0, array(3), 0);

Code: [Select]
The database value you're trying to insert does not exist: to_members

What am I doing wrong?