Webservice (previously Entry API) is a module that creates a REST/XMLRPC/SOAP server under the hood of the ExpressionEngine CMS. It support out of the box a Entry API with support for third party addons (Grid, Matrix, Playa, Relationship etc...). Additional you can extend the API with other APIs like;Comments, Categories, Channels etc...
Make sure your system meets the minimum requirements:
License key The license key given by Devot-ee
Report anonymously PHP and EE versions
This are methods that are free to use, without any login
Blacklist an IP
The trigger when calling the webservice
The super admin API key. With this key you can login as super admin.
Set the output header for the rest service, handy in some cases with "access control allow origin" issues.
Handle strict usage for site_ids
Enable the debug mode
The API Keys are designed to give easy access through an API Key.
Api Keys can be added on the member API page.
The follwing appreach can be archieved for example by the REST service
http://domain.com/webservice/rest/read_entry?auth[api_key]&data[entry_id]=1
Each call can be logged via the logging manager that comes with the Webservice module.
The setting can be found on the member detail page
The overview page can be found in the menu of the Webservice module
The Webservice module will also comes with a fully featured testing tool to test your API. The Testing Tool is located within the CP of the Webservice module
Navigate to the CP of the Webservice module and click on 'Testing tools'
When you clicked on the Testing Tools button, you will navigated to the start page where you have the option for an API.
By selecting one of this API`s, you will go to the testing page for this specific API. For example the Entry API
By the Entry API you will also notice that there is an extra field "extra", this field will accept an PHP array to extend the fields. In case you want to test your own custom fields.
array(
'playa' => array(
2,3,4,5
),
);
You will also notice that all services can be tested, be awere that you need the SOAP extension for the SOAP API.
The following urls are used for the service
<method_name>
/<output>
?<get_values>
create_entry
delete_entry
etc.json
php
xml
)Auth via header in a REST request via the following key for auth: "webserviceauth[fieldname]" data: "webservice_data[field_name]"
All kind of rights and restrictions can as usually be managed in the Control Panel for the membergroups. This module will grab it from there. There will be also a check on the fields that are required.
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
group | the name of the group | Required |
limit | The limit | Optional |
order | The order of the list | Optional |
Response
Array
(
[group_id] => 1
[group_title] => 1
[group_url] => http://google.nl
[site_id] => 1
[adgroup_id] => 1
[ad_id] => 1
[sort_order] => 0
[ad_title] => just a title
[ad_image] => url_to_image.png
[ad_remote_image] => null
[ad_url] => http://google.nl
[ad_alt] => just an alt text
[ad_text] => Just a text
[ad_start] => 2014-08-23 00:00:00
[ad_end] => 2015-08-23 00:00:00
[ad_width] => 0
[ad_height] => 0
[ad_max_click] => 9999
[ad_max_impression] => 99999
[client_id] => 1
[ad_impression] => 12
[ad_clicks] => 0
[ad_cpc] => 0.00
[total_results] => 1
[is_flash] => 0
)
(added in v3.5)
ee()->extensions->call('webservice_create_category_start', $post_data);
webservice_show_adman_end
(added in v3.5)
ee()->extensions->call('webservice_create_category_end', $return_data);
The Auth API comes natively with Webservice module.
Short name | Description | |
---|---|---|
username | Your username | Required |
password | Your password | Required |
new_session | Create a new session | Optional |
Request
$client = new SoapClient('your-domain.com/index.php/webservice/soap?wsdl', array('trace' => 1));
$session_data = $client->authenticate_username('testUsername', 'testPassword');
print_r($session_data);
Request (new session)
$client = new SoapClient('your-domain.com/index.php/webservice/soap?wsdl', array('trace' => 1));
$session_data = $client->authenticate_username('testUsername', 'testPassword', 'yes');
print_r($session_data);
system/expressionengine/third_party dir
Short name | Description | |
---|---|---|
group_id | The group id | Required |
parent_id | The parent category id | Optional |
cat_name | The category name | Required |
cat_description | The category description | Optional |
cat_order | The order id | Optional |
custom_field | Any custom field | Optional |
Request
Array
(
[group_id] => 1
[parent_id] => 1
[cat_name] => test category
[cat_description] => test description
)
Short name | Description | |
---|---|---|
cat_id | The category id | Required |
Request
Array
(
[cat_id] => 2
)
Short name | Description | |
---|---|---|
cat_id | The category id | Required |
group_id | The group id | Optional |
parent_id | The parent category id | Optional |
cat_name | The category name | Optional |
cat_description | The category description | Optional |
cat_order | The order id | Optional |
custom_field | Any custom field | Optional |
Request
Array
(
[cat_id] => 1
[group_id] => 1
[parent_id] => 1
[cat_name] => test category
[cat_description] => test description
[cat_order] => 3
)
Short name | Description | |
---|---|---|
cat_id | The id of the category | Required |
Request
Array
(
[cat_id] => 2
)
(added in v2.2)
ee()->extensions->call('webservice_create_category_end', $category_id);
(added in v2.2)
ee()->extensions->call('webservice_read_category_end', $category_data);
(added in v2.2)
ee()->extensions->call('webservice_update_category_end', $category_data);
(added in v2.2)
ee()->extensions->call('webservice_delete_category_end', '');
system/expressionengine/third_party dir
Short name | Description | |
---|---|---|
group_name | The group name | Required |
exclude_group | 0=none, 1=Channel Assignment, 3=File Assignment | Optional |
field_html_formatting | none, safe or all | Optional |
can_edit_categories | a membergroup ID | Optional |
can_delete_categories | a membergroup ID | Optional |
Request
Array
(
[group_name] => Test group
[exclude_group] => 0
[field_html_formatting] => all
[can_edit_categories] => 6
[can_delete_categories] => 6
)
Short name | Description | |
---|---|---|
group_id | The group id | Required |
show_children | Get also all category children | Optional |
Request
Array
(
[group_id] => 2
[show_children] => yes
)
Short name | Description | |
---|---|---|
group_id | The id of the group | Required |
group_name | The group name | Optional |
exclude_group | 0=none, 1=Channel Assignment, 3=File Assignment | Optional |
field_html_formatting | none, safe or all | Optional |
can_edit_categories | a membergroup ID | Optional |
can_delete_categories | a membergroup ID | Optional |
Request
Array
(
[group_id] => 14
[group_name] => Test group
[exclude_group] => 0
[field_html_formatting] => all
[can_edit_categories] => 6
[can_delete_categories] => 6
)
Short name | Description | |
---|---|---|
group_id | The id of the group | Required |
Request
Array
(
[group_id] => 14
)
(added in v2.2)
ee()->extensions->call('webservice_create_category_group_end', $category_group_id);
(added in v2.2)
ee()->extensions->call('webservice_read_category_group_end', $category_group_data);
(added in v2.2)
ee()->extensions->call('webservice_update_category_group_end', $category_group_data);
(added in v2.2)
ee()->extensions->call('webservice_delete_category_group_end', '');
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
site_id | The site ID | Required |
channel_title | The channel title | Required |
channel_name | The channel name | Required |
url_title_prefix | The url prefix | Optional |
comment_expiration | The comment expiration date | Optional |
status_group | Status group ID | Optional |
field_group | Field group ID | Optional |
channel_url | The channel url | Optional |
channel_lang | Language of the channel | Optional |
group_order | Order position | Optional |
Request
Array
(
[site_id] => 1
[channel_title] => Test Channel
[channel_name] => test_channel
)
Short name | Description | |
---|---|---|
channel_id | The channel ID | Required |
Request
Array
(
[channel_id] => 1
)
Short name | Description | |
---|---|---|
channel_id | The channel ID | Required |
channel_title | The channel title | Optional |
channel_name | The channel name | Optional |
url_title_prefix | The url prefix | Optional |
comment_expiration | The comment expiration date | Optional |
status_group | Status group ID | Optional |
field_group | Field group ID | Optional |
channel_url | The channel url | Optional |
channel_lang | Language of the channel | Optional |
group_order | Order position | Optional |
Request
Array
(
[channel_id] => 1
[channel_title] => Test Channel
[channel_name] => test_channel
)
Short name | Description | |
---|---|---|
channel_id | The channel ID | Required |
Request
Array
(
[channel_id] => 1
)
(added in v3.0)
ee()->extensions->call('webservice_create_channel_end', $channel_id);
(added in v3.0)
ee()->extensions->call('webservice_read_channel_end', $channel_read_data);
(added in v3.0)
ee()->extensions->call('webservice_update_channel_end', $channel_update_data);
(added in v3.0)
ee()->extensions->call('webservice_delete_channel_end', $channel_id);
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
comment | The Comment | Required |
member_id | The Member ID | Required |
name | The Name | Required (if no member_id is given) |
The email address | Required (if no member_id is given) | |
location | The member Location | Optional |
url | A valid Url | Optional |
Request
Array
(
[comment] => a nice comment
[member_id] => 1
)
Short name | Description | |
---|---|---|
comment_id | The comment ID | Required |
Request
Array
(
[comment_id] => 43
)
Short name | Description | |
---|---|---|
comment_id | The Comment ID | Required |
comment | The Comment | Optional |
name | The Name | Optional |
The email address | Optional | |
location | The member Location | Optional |
url | A valid Url | Optional |
Request
Array
(
[comment_id] => 43
[comment] => an update for the comment
)
Currently not available: Assign comment to another entry ID
Short name | Description | |
---|---|---|
comment_id | The comment ID | Required |
Request
Array
(
[comment_id] => 43
)
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
key | The config key | Required |
Request
Array
(
[key] => url_title
)
The Auth API comes natively with Webservice module.
Short name | Description | |
---|---|---|
channel_name | The name of the channel where the entry must be inserted | Required |
title | The title for the entry | Required |
status | The status of the entry | Optional |
allow_comments | Allow comments? | Optional |
sticky | Is the entry sticky? | Optional |
custom_fields | Any custom fields can be added | Optional |
category | array of category ids | Optional |
Request
Array
(
[status] => Closed
[title] => Test entry
[sticky] => y
[allow_comments] => n
//custom fields
[news_body] => This is a full body text
[news_extended] => This is some small text
[category] => Array(
1,2,3,4
)
[custom_file_field] => Array(
'filedata' => base64_encode(file_get_contents('path_to_image.jpg')),
'filename' => 'filename.jpg',
'dir_id' => 6
)
)
See search_entry method because of v3.5 they are the same
Short name | Description | |
---|---|---|
entry_id | The entry ID | Required |
title | The title for the entry | Optional |
status | The status of the entry | Optional |
allow_comments | Allow comments? | Optional |
sticky | Is the entry sticky? | Optional |
custom_fields | Any custom field(s) | Optional |
category | array of category ids | Optional |
Request
Array
(
[status] => Closed
[title] => Test entry
[sticky] => y
[allow_comments] => n
//custom fields
[news_body] => This is a full body text
[news_extended] => This is some small text
)
Short name | Description | |
---|---|---|
entry_id | The entry ID | Required |
Request
Array
(
[entry_id] => 14
)
The search mechanism is identical to the search method from the Channel module
Short name | Description | |
---|---|---|
channel | If you use only the channel_name you wil get all entries in this channel | Optional |
channel_id | Search on Channel ID | Optional |
limit | The limit, can be used in conjunction with the offset | Optional |
offset | the offset, can be used in conjunction with the limit | Optional |
custom_fields | any other custom field | Optional |
order | set the order | Optional |
sort | set the sort | Optional |
entry_id | If selecting just one entry by entry_id | Optional |
url_title | Search on an URL Title | Optional |
status | The status of an entry | Optional |
grid_field/matrix_cellname | Search in any grid/matrix cell | Optional |
output_fields | specify the field to output (applied also on the relationships) | Optional |
search_all | Magic keyword that will search in all entry fields | Optional |
Request
Array
(
[channel] => news_channel
[limit] => 25
[offset] => 5
)
(added in v3.2.1)
$entry_data = ee()->extensions->call('webservice_create_entry_start', $entry_data);
(added in v2.2)
ee()->extensions->call('webservice_create_entry_end', $entry_id, $post_data);
(added in v3.2.1)
$entry_data = ee()->extensions->call('webservice_read_entry_start', $entry_data);
(added in v4.4.2)
Runs after the validation
$entry_data = ee()->extensions->call('webservice_read_entry', $entry_data, $post_data);
(added in v2.2)
$entry_data = ee()->extensions->call('webservice_read_entry_end', $entry_data);
(added in v3.2.1)
$entry_data = ee()->extensions->call('webservice_update_entry_start', $entry_data);
(added in v4.4.2)
Runs after the validation
$entry_data = ee()->extensions->call('webservice_update_entry', $entry_data, $post_data);
(added in v2.2)
ee()->extensions->call('webservice_update_entry_end', $entry_data, $post_data);
(added in v3.2.1)
$entry_data = ee()->extensions->call('webservice_delete_entry_start', $entry_data);
(added in v2.2)
ee()->extensions->call('webservice_delete_entry_end', '');
(added in v4.0)
With this hook you can extend the search by your own. Just make sure the hook will return an array of entry_ids.
$entry_ids = ee()->extensions->call('webservice_search_entry_per_entry', $values, $fields);
(added in v3.2)
$entry_data = ee()->extensions->call('webservice_search_entry_per_entry', $entry_data);
(added in v3.2)
$entry_data = ee()->extensions->call('webservice_search_entry_per_entry', $entry_data);
(added in v3.2.1)
$entry_data = ee()->extensions->call('webservice_search_entry_start', $entry_data);
(added in v2.2)
$entry_data = ee()->extensions->call('webservice_search_entry_end', $entry_data);
(added in v3.5)
WIll be called when reading an entry
$entry_data = ee()->extensions->call('webservice_entry_row', $entry_data);
(added in v4.0)
ee()->extensions->call('webservice_read_entry_matrix', $value, $col_settings);
(added in v4.0)
ee()->extensions->call('webservice_read_entry_grid', $value, $col_settings);
<?php
//file data
$image = 'file.jpg';
$file = base64_encode(file_get_contents($image));
$client = new SoapClient('your-domain.com/index.php/webservice/soap?wsdl', array('trace' => 1));
$reponse = $client->create_entry(array(
'username' => 'testUsername',
'password' => 'testPassword'
), array(
'channel_name' => 'news',
'status' => 'Open',
'title' => 'test entry',
'sticky' => 'y',
'allow_comments' => 'n',
'category' => '1|2|3',
'filefield' => array(
'filedata' => $file,
'filename' => 'file.jpg',
'dir_id' => 6
)
));
?>
<?php
$url = 'http://ee312.local/index.php/webservice/rest/create_entry';
//set POST variables
$fields = array(
'auth' => array(
'username' => 'admin',
'password' => 'test123',
),
'data' => array(
'channel_name' => 'test_channel',
'title' => 'Test entry',
)
);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, urldecode(http_build_query($fields)));
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
?>
<?php
//http://gggeek.github.io/phpxmlrpc/
include("xmlrpc/xmlrpc.inc");
$c = new xmlrpc_client('http://domain.com/index.php/webservice/xmlrpc');
$x = new xmlrpcmsg('create_entry', array(
php_xmlrpc_encode(array(
'username' => 'admin',
'password' => 'test123',
)),
php_xmlrpc_encode(array(
'channel_name' => 'test_channel',
'title' => 'Test entry',
)),
));
$c->return_type = 'phpvals';
$r =$c->send($x);
?>
system/expressionengine/third_party dir
Short name | Description | |
---|---|---|
list_name | The short name | Required |
list_title | The title | Required |
Request
Array
(
[list_name] => test_mailinglist
[list_title] => Test Mailinglist
)
Short name | Description | |
---|---|---|
list_id | The list id | Required |
Request
Array
(
[list_id] => 2
)
Short name | Description | |
---|---|---|
list_id | The id of the mailinglist | Required |
list_name | The short name | Optional |
list_title | The title of the list | Optional |
list_template | The template of the list | Optional |
Request
Array
(
[list_id] => 14
[list_name] => test_group
)
Short name | Description | |
---|---|---|
list_id | The id of the mailinglist | Required |
Request
Array
(
[list_id] => 14
)
Short name | Description | |
---|---|---|
list_id | The id of the mailinglist | Required |
The email | Required |
Request
Array
(
[list_id] => 14
[email] => test@example.com
)
Short name | Description | |
---|---|---|
list_id | The id of the mailinglist | Required |
The email | Required |
Request
Array
(
[list_id] => 14
[email] => test@example.com
)
(added in v1.0)
$post_data = ee()->extensions->call('webservice_create_mailinglist_start', $post_data);
(added in v1.0)
ee()->extensions->call('webservice_create_mailinglist_end', $list_id);
(added in v1.0)
$post_data = ee()->extensions->call('webservice_read_mailinglist_start', $post_data);
(added in v1.0)
ee()->extensions->call('webservice_delete_category_group_end', $list_id);
(added in v1.0)
$post_data = ee()->extensions->call('webservice_update_mailinglist_start', $post_data);
(added in v1.0)
ee()->extensions->call('webservice_update_mailinglist_end', $list_id);
(added in v1.0)
$post_data = ee()->extensions->call('webservice_delete_mailinglist_start', $post_data);
(added in v1.0)
ee()->extensions->call('webservice_delete_mailinglist_end', $list_id);
(added in v1.0)
$post_data = ee()->extensions->call('webservice_create_subscription_end', $post_data);
(added in v1.0)
ee()->extensions->call('webservice_create_subscription_end', $list_id);
(added in v1.0)
$post_data = ee()->extensions->call('webservice_delete_subscription_start', $post_data);
(added in v1.0)
ee()->extensions->call('webservice_delete_subscription_end');
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
group_id | The group ID | Required |
username | Required | |
screen_name | Required | |
password | Required | |
Required | ||
url | Optional | |
location | Optional | |
bio | Optional | |
language | Optional | |
timezone | Optional | |
date_format | Optional | |
time_format | Optional | |
include_seconds | Optional | |
bday_y | Optional | |
bday_m | Optional | |
bday_d | Optional | |
occupation | Optional | |
interests | Optional | |
aol_im | Optional | |
icq | Optional | |
yahoo_im | Optional | |
msn_im | Optional | |
custom_fields | Optional |
Request
Array
(
[group_id] => 2
[username] => test user
[screen_name] => Test User
[password] => du*7e2O
[email] => info@test.com
)
Short name | Description | |
---|---|---|
member_id | The member ID | Required |
Request
Array
(
[member_id] => 2
)
Short name | Description | |
---|---|---|
member_id | The member ID | Required |
screen_name | Optional | |
Optional | ||
url | Optional | |
location | Optional | |
bio | Optional | |
language | Optional | |
timezone | Optional | |
date_format | Optional | |
time_format | Optional | |
include_seconds | Optional | |
bday_y | Optional | |
bday_m | Optional | |
bday_d | Optional | |
occupation | Optional | |
interests | Optional | |
aol_im | Optional | |
icq | Optional | |
yahoo_im | Optional | |
msn_im | Optional | |
custom_fields | Optional |
Request
Array
(
[member_id] => 2
[msn_im] => jan0292
)
Limitation:
Password and username update has been disabled due some EE complexity
Short name | Description | |
---|---|---|
member_id | The member ID | Required |
Request
Array
(
[member_id] => 2
)
the default EE hooks are being used.
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
site_id | The site ID | Required |
group_title | Required | |
group_description | Optional | |
search_flood_control | Optional | |
prv_msg_send_limit | Optional | |
prv_msg_storage_limit | Optional | |
channels | Assigned channels (pipeline seperated) | Optional |
modules | Assigned modules (pipeline seperated) | Optional |
template_groups | Assigned template_groups (pipeline seperated) | Optional |
is_locked | Optional | |
can_view_offline_system | Optional | |
can_view_offline_system | Optional | |
can_access_cp | Optional | |
can_access_content | Optional | |
can_access_publish | Optional | |
can_access_edit | Optional | |
can_access_files | Optional | |
can_access_fieldtypes | Optional | |
can_access_design | Optional | |
can_access_addons | Optional | |
can_access_modules | Optional | |
can_access_extensions | Optional | |
can_access_accessories | Optional | |
can_access_plugins | Optional | |
can_access_members | Optional | |
can_access_admin | Optional | |
can_access_sys_prefs | Optional | |
can_access_content_prefs | Optional | |
can_access_tools | Optional | |
can_access_comm | Optional | |
can_access_utilities | Optional | |
can_access_data | Optional | |
can_access_logs | Optional | |
can_admin_channels | Optional | |
can_admin_upload_prefs | Optional | |
can_admin_design | Optional | |
can_admin_members | Optional | |
can_delete_members | Optional | |
can_admin_mbr_groups | Optional | |
can_admin_mbr_templates | Optional | |
can_ban_users | Optional | |
can_admin_modules | Optional | |
can_admin_templates | Optional | |
can_edit_categories | Optional | |
can_delete_categories | Optional | |
can_view_other_entries | Optional | |
can_edit_other_entries | Optional | |
can_assign_post_authors | Optional | |
can_delete_self_entries | Optional | |
can_delete_all_entries | Optional | |
can_view_other_comments | Optional | |
can_edit_own_comments | Optional | |
can_delete_own_comments | Optional | |
can_edit_all_comments | Optional | |
can_delete_all_comments | Optional | |
can_moderate_comments | Optional | |
can_send_email | Optional | |
can_send_cached_email | Optional | |
can_email_member_groups | Optional | |
can_email_mailinglist | Optional | |
can_email_from_profile | Optional | |
can_view_profiles | Optional | |
can_edit_html_buttons | Optional | |
can_delete_self | Optional | |
mbr_delete_notify_emails | Optional | |
can_post_comments | Optional | |
exclude_from_moderation | Optional | |
can_search | Optional | |
can_send_private_messages | Optional | |
can_attach_in_private_messages | Optional | |
can_send_bulletins | Optional | |
include_in_authorlist | Optional | |
include_in_memberlist | Optional | |
include_in_mailinglists | Optional | |
search_flood_control | Optional | |
search_flood_control | Optional |
Request
Array
(
[site_id] => 1
[group_title] => Test group
[can_view_offline_system] => y
[can_search] => n
)
Short name | Description | |
---|---|---|
group_id | The group ID | Required |
Request
Array
(
[group_id] => 2
)
Short name | Description | |
---|---|---|
site_id | The site ID | Required |
group_id | The membergroup ID | Required |
group_title | Required | |
group_description | Optional | |
search_flood_control | Optional | |
prv_msg_send_limit | Optional | |
prv_msg_storage_limit | Optional | |
channels | Assigned channels (pipeline seperated) | Optional |
modules | Assigned modules (pipeline seperated) | Optional |
template_groups | Assigned template_groups (pipeline seperated) | Optional |
is_locked | Optional | |
can_view_offline_system | Optional | |
can_view_offline_system | Optional | |
can_access_cp | Optional | |
can_access_content | Optional | |
can_access_publish | Optional | |
can_access_edit | Optional | |
can_access_files | Optional | |
can_access_fieldtypes | Optional | |
can_access_design | Optional | |
can_access_addons | Optional | |
can_access_modules | Optional | |
can_access_extensions | Optional | |
can_access_accessories | Optional | |
can_access_plugins | Optional | |
can_access_members | Optional | |
can_access_admin | Optional | |
can_access_sys_prefs | Optional | |
can_access_content_prefs | Optional | |
can_access_tools | Optional | |
can_access_comm | Optional | |
can_access_utilities | Optional | |
can_access_data | Optional | |
can_access_logs | Optional | |
can_admin_channels | Optional | |
can_admin_upload_prefs | Optional | |
can_admin_design | Optional | |
can_admin_members | Optional | |
can_delete_members | Optional | |
can_admin_mbr_groups | Optional | |
can_admin_mbr_templates | Optional | |
can_ban_users | Optional | |
can_admin_modules | Optional | |
can_admin_templates | Optional | |
can_edit_categories | Optional | |
can_delete_categories | Optional | |
can_view_other_entries | Optional | |
can_edit_other_entries | Optional | |
can_assign_post_authors | Optional | |
can_delete_self_entries | Optional | |
can_delete_all_entries | Optional | |
can_view_other_comments | Optional | |
can_edit_own_comments | Optional | |
can_delete_own_comments | Optional | |
can_edit_all_comments | Optional | |
can_delete_all_comments | Optional | |
can_moderate_comments | Optional | |
can_send_email | Optional | |
can_send_cached_email | Optional | |
can_email_member_groups | Optional | |
can_email_mailinglist | Optional | |
can_email_from_profile | Optional | |
can_view_profiles | Optional | |
can_edit_html_buttons | Optional | |
can_delete_self | Optional | |
mbr_delete_notify_emails | Optional | |
can_post_comments | Optional | |
exclude_from_moderation | Optional | |
can_search | Optional | |
can_send_private_messages | Optional | |
can_attach_in_private_messages | Optional | |
can_send_bulletins | Optional | |
include_in_authorlist | Optional | |
include_in_memberlist | Optional | |
include_in_mailinglists | Optional | |
search_flood_control | Optional | |
search_flood_control | Optional |
Request
Array
(
[group_id] => 2
[can_send_email] => n
)
Short name | Description | |
---|---|---|
group_id | The group ID | Required |
Request
Array
(
[group_id] => 2
)
the default EE hooks are being used.
system/expressionengine/third_party
dirShort name | Description | |
---|---|---|
site_id | The site ID | Required |
group_name | The group name | Required |
group_order | Optional | |
is_site_default | Optional |
Request
Array
(
[site_id] => 1
[group_name] => Test group
[is_site_default] => n
)
Short name | Description | |
---|---|---|
group_id | The group ID | Required |
Request
Array
(
[group_id] => 2
)
Short name | Description | |
---|---|---|
site_id | The site ID | Required |
group_id | The group ID | Required |
group_name | The group name | Required |
group_order | Optional | |
is_site_default | Optional |
Request
Array
(
[group_id] => 2
[is_site_default] => y
)
Short name | Description | |
---|---|---|
group_id | The group ID | Required |
Request
Array
(
[group_id] => 2
)
All API methods, except the Auth API, will accept a default set of values. For example i will take the API method create_entry
.
The accpeted parameters are always 2 arrays. The first one is the auth
array and the second one is the data
array.
The auth array has a structure like this:
Array
(
[username] => test
[password] => testPassword
[api_key] => y63idklo93
)
The username
and password
belong together, api_key
(defined in the cp) are standalone vars.
the data structure is a also a associative array, and wil lbe described on the method page.
The Relationship/Playa extension will add a new value to the read_entry
and search_entry
that include the parents of the relationship child.
[ext_playa_parents] => [{"rel_id":"6","parent_entry_id":"5","parent_field_id":"3","order":"0"},{"rel_id":"7","parent_entry_id":"3","parent_field_id":"3","order":"0"}]
[ext_relationship_parents] => [{"rel_id":"1","parent_entry_id":"5","parent_field_id":"4","order":"1"},{"rel_id":"2","parent_entry_id":"3","parent_field_id":"4","order":"1"}]
The Structure extension will add some extra structure data to the entry array.
[structure] => {"hide_from_nav":"n","hidden":"n","listing_channel_id":"2","listing_channel_name":"news","listings_total":0}
Read/convert your Relationship out of an Matrix/Grid field and get the actual entry instead.
Convert your relationship field (also Playa) with real entry data instead of entry_ids
Convert the moreMatrixRelations field in an entry
Read your Simple S3 upload out of an Matrix/Grid field
The Webservice module provide a set of API methods to make your fieldtype compatible. In order to develop such funtionality, you have to create a fieldtype first. When you`re done, you can add some of the following functions below.
If your Fieldtype only save the data to the channel_data
table, you don`t have to do anything. The Webservice module will support this out of the box. However, if your data need some specific data structure, you have to use this API to make your field compatible with the Webservice module.
You will mostly need the webservice_save
webservice_validate
and webservice_pre_process
webservice_save
function you can strucutre your data, like on the publish page (see the matrix file as example). webservice_validate
will be your validate function which called before the webservice_api_save
function. On false
, the data will not be processed.webservice_pre_process
can be used to strucutre your data on read or search.As an example of how Matrix data can be submitted with the Webservice module:
'matrix_field' => array(
'rows' => array(
array(
'cell_1' => 'row 1',
'cell_2' => 'row 11',
),
array(
'cell_1' => 'row 2',
'cell_2' => 'row 22'
)
),
'trigger_revisions' => 1
);
This data structure will be converted with the fieldtype API to a correct data structure.
Below are the Tag Parameters. Those parameters can be used in the tag described above
Holds the field type
$this->field_type = '';
Holds the field name
$this->field_name = '';
Holds the field id
$this->field_id = 0;
Holds an array of the field data
$this->field_data = array();
Holds an array of the field settings
$this->field_settings = array();
Holds the channel settings
$this->channel_settings = array();
Preps the data for saving. or you can save your data to your own fields instead.
$data
: null
$is_new
: null
$entry_id
: 0
return
: string
public function webservice_save($data = null, $is_new = false, $entry_id = 0)
{
return $data;
}
Validates the field input.
$data
: null
$is_new
: null
return
: bool
public function webservice_validate($data = null, $is_new = false)
{
//$this->validate_error = '';
return true;
}
Handles any custom logic after an entry is saved.
$data
: null
$inserted_data
: array()
$entry_id
: 0
return
: void
public function webservice_post_save($data = null, $inserted_data = array(), $entry_id = 0)
{
}
Preprocess the data to be returned. Convert any complex data to a nice string or array. The Webservice will convert any Array to a json string.
$data
: null
$free_access
: false
$entry_id
: 0
return
: mixed
public function webservice_pre_process($data = null, $free_access = false, $entry_id = 0)
{
return $data;
}
Delete field data. Here you can add some additional deletion for your own fieldtype.
$data
: null
$entry_id
: 0
return
: void
public function webservice_delete($data = null, $entry_id = 0)
{
}
The Webservice module has also support for searching in Grid or Matrix cells.
http://domain.com/webservice/rest/search_entry?auth[api_key]=27dd39e*7d&data[grid][cell_1]=test
As you can see, you only have to use a multi dimensional array to do this.
Out of the box the the Webservice module support all fieldtypes that save their data to the exp_channel_data
table. Other addons that using their own table or do something with files for example are not supported, unless they listed below.
If you found an addon that has no support for the Webservice, you can send me an email.
Natively: The following syntax is needed.
array(
'grid' => array(
'rows' => array(
array(
'cell_1' => 'row 1',
'cell_2' => 'row 11'
),
array(
'cell_1' => 'row 2',
'cell_2' => 'row 22'
),
),
),
);
Natively: The following syntax is needed.
array(
'relationship' => array(
2,3,4,5
),
);
Natively: he following syntax is needed.
array(
'matrix' => array(
'rows' => array(
array(
'cell_1' => 'row 1',
'cell_2' => 'row 11'
),
array(
'cell_1' => 'row 2',
'cell_2' => 'row 22'
),
),
),
);
Natively: The following syntax is needed.
array(
'playa' => array(
2,3,4,5
),
);
Natively: The following syntax is needed.
On update, you can avoid some values because the Webservice module detect the member based on the entry_id
array(
'member_account' => array(
'email' => 'test@test.com',
'username' => 'John Doe',
'password' => 'test123',
'screen_name' => 'John Doe',
'group_id' => '4',
),
);
Store only adds basic support in the read/search method.
All fields, but not all are converted good (please make a thread here)