(added in v3.2.11)

The blog API contains all API calls for creating and retrieving media (files/photos/vtours) info.


Methods: blog__    

search($data) - Used to search blog data.

search(array $data) : array


Returns: (array)

The array returned will contain the following:

['error'] - TRUE/FALSE - Error status of the search request

['error_msg'] - TEXT - Error message returned (if ['error'] = TRUE).

['blog_count'] = Number of Blog articles found that match the search, if using a limit this is only up to the number of records that match your current limit/offset results.

['blogs'] = Array of blogmain_id#s that match the search.

['info'] = The info array contains benchmark information on the search, includes: process_time, query_time, and total_time

['sortby'] = Contains an array of fields that were used to sort the search results. Note: if you are doing a count only search the sort is not actually used as this would just uselessly slow down the query.

['sorttype'] = Contains an array of the sorttype (ASC/DESC) used on the sortby fields.

['limit'] - INT - The numeric limit being imposed on the results.

['offset'] - INT - The numeric offset that was used to generate these results


Parameters:

$data (array)

Expects an array containing the following array keys:

$data['parameters']['FIELDNAME'] - REQUIRED - Array of the fields and the values we are searching for. At least one option below is required:

blogmain_id - INT - the ID# of the blog

userdb_id - INT - The OR User ID# of the blog's creator

blogmain_title - TEXT - One or more words of the expected Blog Title

blog_creation_date_greater - TIMESTAMP

blog_creation_date_less - TIMESTAMP

blog_creation_date_equal_days - TIMESTAMP

blog_creation_date_greater_days - TIMESTAMP

blog_creation_date_less_days - TIMESTAMP

blogmain_full - TEXT - A word or phrase expected to be in an existing Blog Article. Note: all markup is stripped before comparison when this option is used, searching for HTML or similar markup elements is not possible.

blogmain_description - TEXT -  A word or phrase expected to be in the Meta Description of the Blog Article

blogmain_keywords - TEXT -  One or more Meta Keywords expected to be set as the Meta Keywords of the Blog Article

blogmain_published - INT/TEXT - The Blog publish status: Options: any = all statuses, 0 = Draft, 1 = Live , 2 = Review. providing any other value will default to "Live"

blog_categories - ARRAY - INT -  An array of the numeric blog category_id #s

blog_post_tags - ARRAY - INT -  An array of the numeric blog tag_id #s


$data['sortby'] - This is an optional array of fields to sort by.Options are::

blogmain_id

userdb_id

blogmain_title

blogmain_date

blogmain_published

random

$data['sorttype'] - This is an optional array of sort types (ASC/DESC) to sort the sortby fields by.

$data['offset'] - This is an optional integer of the number of Blog articles to offset the search by. To use offset you must also set a limit.

$data['limit'] - This is an optional integer of the number of blogs to limit the results by. 0 or unset will return all blogs. Only active/live blogs will be returned if the user is not logged into an account with permission.

$data['count_only'] - This is an optional integer flag 1/0, where 1 returns a record count only, defaults to 0 if not set. Useful if doing limit/offset search for pagination to get the initial full record count..


example:

<?php

       //get the blogmain_id for all the blogs with a published status of Live for User ID #2 that contain the text "repo" in the blog article. Sort results by blog date in DESC order

       $result = $api->load_local_api('blog__search',array(

        'parameters'=>array(

            'blogmain_published' =>1,

            'userdb_id'=>2

        ),

        'sortby'=>array('blogmain_date'),

        'sorttype'=>array('DESC'),

        'limit'=>10,

        'offset'=>0,

        'count_only'=>0

    ));

       // format and output the contents of the $result array so the keys

       // and values can be seen.

       echo '<pre>';

       print_r($result);

       echo '</pre>';

?>




read($data) - Used to read/retrieve data from a specific blog.

read(array $data) : array


Returns: (array)

['error'] - TRUE/FALSE - Error status of the read request

['error_msg'] - TEXT - Error message returned (if ['error'] = TRUE).

['blog'] - ARRAY - Array containing information relevant to the blog requested. Array keys within ['blog'] correspond to their OR blogmain table column names.

['blog']['blogmain_id'] - INT - Blog Article ID#

['blog']['userdb_id'] - INT - The userdb_id of the Blog's Author

['blog']['blogmain_title'] - TEXT - The Title of the Blog Article

['blog'][blog_seotitle] - TEXT - The SEO friendly page title

['blog'][blogmain_date] - TIMESTAMP - UNIX Timestamp of the Article's creation date

['blog'][blogmain_full] - TEXT/MARKUP - The raw HTML markup and text of the Blog article.

['blog'][blogmain_description] - TEXT - The Meta Description of the Blog Article

['blog'][blogmain_keywords] - TEXT - The Meta keywords, comma delimited e.g. keyword1, keyword2, etc

['blog'][blogmain_published] - INT  - Published status of the Blog article. 0 = Draft, 1 = Live, 2 = Pending Review

['blog']['blog_url'] - TEXT - URL - Full text URL to the blog page, uses SEO friendly if set

['blog']['blog_author_firstname'] - TEXT - The Blog Author's First Name

['blog']['blog_author_lastname'] - TEXT - The Blog Author's Last Name

['blog']['blog_categories'] - ARRAY - Each array key is the category_id and each value is the category_name the blog is assigned to.

['blog']['blog_post_tags']['#'] - MULTI ARRAY - A multi-dimensional array of each Blog tag_id# assigned to the blog. Contains keys:

['#'] ['tag_name'] - TEXT - The blog tag name

['#'] ['tag_seoname'] - TEXT - the blog tag SEO name

['#'] ['tag_description'] - TEXT - Description of the blog tag

['#'] ['tag_link'] - TEXT - URL - Full text URL to the Blog page for blogs that use this tag.

['blog']['blog_comment_count'] - INT - The number of blog comments

['blog']['blog_comments'] - TEXT - The Blog Author's First Name


Parameters:

$data (array)

Expects an array containing the following array keys:

$data['blog_id'] - INT - REQUIRED This is the numeric OR blogmain_id of the Blog Article you wish to access.

$data['fields']['FIELDNAME'] - ARRAY/TEXT - OPTIONAL This is an optional array of fields to retrieve, if left empty or not passed all fields and info will be retrieved. Applicable field names are as follows:

blogmain_id

userdb_id

blogmain_title

blog_seotitle

blogmain_date

blogmain_full

blogmain_description

blogmain_keywords

blogmain_published

blog_url

blog_author_firstname

blog_author_lastname

blog_categories

blog_post_tags

blog_comment_count

blog_comments


Example: retrieve all info for all fields for Blog article blogmain_id #4

<?php

       //retrieve all info for Blog Article ID #4

       $result = $api->load_local_api('blog__read',array(

               'blog_id'=>4

       ));

       // format and output the contents of the $result array so the keys

       // and values can be seen.

       echo '<pre>';

    print_r($result);

echo '</pre>';

?>




delete($data) - Used to delete a blog article completely. Any associated media belonging to it is also removed.

delete(array $data) : array


Returns: (array)

['error'] - TRUE/FALSE - Error status of the delete request

['error_msg'] - TEXT - Error message returned (if ['error'] = TRUE).

['blog_id'] - INT - Numeric blogmain_id of the Blog Article deleted.


Parameters:

$data (array)

Expects an array containing the following array keys:

$data['blog_id'] - INT - Numeric blogmain_id of the blog to delete.


example:

<?php

       //deletes userdb_id #4 and any associated listings and media

       $result = $api->load_local_api('blog__delete',array(

                               'blog_id'=>4

       ));

       // format and output the contents of the $result array so the keys

       // and values can be seen.

       echo '<pre>';

       print_r($result);

       echo '</pre>';

?>