Skip to content

Latest commit

 

History

History
403 lines (242 loc) · 13.4 KB

api-discussion.rst

File metadata and controls

403 lines (242 loc) · 13.4 KB

Discussion API

This API is used to turn content like product reviews, comments on posts and forum threads into JSON. This API can be unleashed onto a forum / comment thread directly, or onto a product page / article page containing comments / reviews.

The Discussion API part of the Diffbot PHP client consists of three main classes: the API class, the Discussion Entity class, and the Post Entity class. We'll describe them in order. Note that the API class extends :phpSwader\\Diffbot\\Abstracts\\Api, so be sure to read that first if you haven't already.

Discussion API Class

Basic Usage:

use Swader\Diffbot\Diffbot;

$url = 'http://some-article-to-process.com';

$diffbot = new Diffbot('my_token');
$api = $diffbot->createDiscussionApi($url);

setMaxPages

setSentiment

Discussion Entity Class

When the Discussion API is done processing a URL, the result will be a Discussion Entity (i.e. a collection of one Discussion Entities inside an instance of :phpSwader\\Diffbot\\Entity\\EntityIterator).

For an overview of the abstract class all Entities build on, see :phpSwader\\Diffbot\\Abstracts\\Entity.

__construct

getType

getNumPosts

getTags

getParticipants

getNumPages

getNextPages

getNextPage

getProvider

getRssUrl

getConfidence

getPosts

Discussion Post Class

Every Discussion entity has children - its posts. Every Post is its own entity, and very similar to :phpSwader\\Diffbot\\Entity\\Article, sharing many of its methods.

getType

getLang

getHumanLanguage

getText

getHtml

getDate

getAuthor

getAuthorUrl

getTags

getSentiment

getVotes

getId

getParentId

getImages

getPageUrl