Contrib API Documentation

Add Member Topics

A forum framework function that add topics subscribed by user

Method

POST

URL

https://e7lq80c199.execute-api.us-west-2.amazonaws.com/api1?

Making a Request

Available post parameters are:
  • request — forum-addmembertopics
  • key — domain API key.
  • topics — topic ids separated by comma.
  • username — Member username.
  • domain — Domain for forum website.

  • Sample Request

    private function createApiCall($url, $method, $headers, $data = array(),$user=null,$pass=null)
    {
    if (($method == 'PUT') || ($method=='DELETE'))
    {
    $headers[] = 'X-HTTP-Method-Override: '.$method;
    }

    $handle = curl_init();
    curl_setopt($handle, CURLOPT_URL, $url);
    curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
    if ($user){
    curl_setopt($handle, CURLOPT_USERPWD, $user.':'.$pass);
    }

    switch($method)
    {
    case 'GET':
    break;
    case 'POST':
    curl_setopt($handle, CURLOPT_POST, true);
    curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($data));
    break;
    case 'PUT':
    curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($handle, CURLOPT_POSTFIELDS, http_build_query($data));
    break;
    case 'DELETE':
    curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'DELETE');
    break;
    }
    $response = curl_exec($handle);
    return $response;
    }


    $headers = array('Accept: application/json');
    $url = 'https://e7lq80c199.execute-api.us-west-2.amazonaws.com/api1';
    $params = array('request'=>'forum-addmembertopics','key'=>'xxxxxxxxxxxxxxxxxxxx',
    'domain'=>'uboard.com','topics'=>'9,10',
    'username'=>'johndoe');
    $result = $this->createApiCall($url, 'POST', $headers, $params);

API Responses

sample json data:
{
"success": true,
"data": {
"message":"Successfully added topic/s"
}
}


API Errors

[
 {
"success":false
 }
]