DwApiOpen
Class for open API methods.
Restrictions set by DaniWeb: all requests are cached, unless an access token is provided (use DwApiOAuth).
Read more about common exceptions.
Get posts for specific articles.
Parameters
$articleId int Article ID (required).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT Invalid article ID.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get a list of (specific) articles.
Parameters
$articleIds int|array Article ID, or array of IDs (optional).
$articleType string Article type (optional).
$sortType string Sort type (optional).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT_ARRAY Invalid article IDs.
DwApiException EX_INVALID_TYPE_ARTICLE Invalid article type.
DwApiException EX_INVALID_TYPE_SORT Invalid sort type.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get a list of articles for specific forum IDs.
Parameters
$forumIds int|array Forum ID, or array of IDs (required).
$articleType string Article type (optional).
$sortType string Sort type (optional).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT_ARRAY Invalid forum IDs.
DwApiException EX_INVALID_TYPE_ARTICLE Invalid article type.
DwApiException EX_INVALID_TYPE_SORT Invalid sort type.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get chat messages for a specific forum. Option to start from a specific message, or to use long polling.
Parameters
$forumId int Forum ID (required).
$sinceId int Last message ID (optional).
$longPolling bool Use long polling (optional), default false.
Exceptions
DwApiException EX_INVALID_INT Invalid forum ID.
DwApiException EX_INVALID_BOOL Invalid long polling.
Return value
string JSON result.
Get posts for a specific forum.
Parameters
$forumId int Forum ID (required).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT Invalid forum ID.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get a list of (specific) forums.
Parameters
$forumIds int|array Forum ID as int, or array of int (optional).
$relation string Relation type (optional).
$includeSelf bool Include the forumID in the result (optional), default false.
Exceptions
DwApiException EX_INVALID_TYPE_INT_ARRAY Invalid forum IDs.
DwApiException EX_INVALID_TYPE_RELATION Non-null invalid relation type.
DwApiException EX_INVALID_BOOL Invalid boolean.
Return value
string JSON result.
Get activities for a specific member.
Parameters
$memberId int Member ID (required).
Exceptions
DwApiException EX_INVALID_INT Invalid member ID.
Return value
string JSON result.
Get a list of articles for a specific member.
Parameters
$memberIds int|array Member IDs (required).
$forumId int Forum ID (optional).
$articleType string Article type (optional).
$sortType string Sort type (optional).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT_ARRAY Invalid member IDs.
DwApiException EX_INVALID_INT Invalid forum ID.
DwApiException EX_INVALID_TYPE_ARTICLE Invalid article type.
DwApiException EX_INVALID_TYPE_SORT Invalid sort type.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get chat messages for a specific member. Option to start from a specific message, or to use long polling.
Parameters
$memberId int Member ID (required).
$sinceId int Last message ID (optional).
$longPolling bool Use long polling (optional), default false.
Exceptions
DwApiException EX_INVALID_INT Invalid forum ID.
DwApiException EX_INVALID_BOOL Invalid long polling.
Return value
string JSON result.
Get endorsements for a specific member.
Parameters
$memberId int Member ID (required).
Exceptions
DwApiException EX_INVALID_INT Invalid member ID.
Return value
string JSON result.
Get post for a specific member.
Parameters
$memberId int Member ID (required).
$postType string Post type (optional).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT Invalid member ID.
DwApiException EX_INVALID_TYPE_POST Invalid post type.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get reputation comments for a specific member.
Parameters
$memberId int Article ID (required).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT Invalid member ID.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get a list of (specific) members.
Parameters
$members int|array|string Member IDs, or member name (optional).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT_ARRAY_STRING Invalid members.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Get reputation comments for a specific post.
Parameters
$postId int Article ID (required).
Exceptions
DwApiException EX_INVALID_INT Invalid post ID.
Return value
string JSON result.
Get a list of (specific) posts.
Parameters
$postIds int|array Post ID, or array of IDs (optional).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_INT_ARRAY Non-null invalid ID's.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Searches articles for the given query.
Parameters
$query string Search query (required).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_STRING Invalid or empty search query.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
Searches members for the given member name.
Parameters
$memberName string Member name to search for (required).
$page int Page number (optional), default 1.
Exceptions
DwApiException EX_INVALID_STRING Invalid or empty member name.
DwApiException EX_INVALID_INT Invalid page number.
Return value
string JSON result.
include 'DwApiOpen.class.php';
$dwApi = new DwApiOpen();
try
{
$dwApi->GetArticlePosts(437592);
$dwApi->GetArticles(array (435023, 437592));
$dwApi->GetForumArticles(17, 'unanswered');
$dwApi->GetForumPosts(17);
$dwApi->GetForums();
$dwApi->GetMemberActivityPoints(94719);
$dwApi->GetMemberArticles(94719, 17, 'code');
$dwApi->GetMemberEndorsements(94719);
$dwApi->GetMemberPosts(94719, 'solved');
$dwApi->GetMemberReputationComments(94719);
$dwApi->GetMembers(94719);
$dwApi->GetPostReputationComments(1867695);
$dwApi->GetPosts(1867695);
$dwApi->SearchArticles('daniweb-api');
$dwApi->SearchMembers('pritaeas');
}
catch (DwApiException $exception)
{
die($exception->getMessage());
}