Skip to content

API Entry ​

Compatibility ​

  • EE2, EE3, EE4, EE5, EE6, EE7

Installation ​

The Entry API comes natively with the Webservice module.


Methods ​

POST /index.php/webservice/entry — Create Entry ​

Create a new entry in a channel.


Request Parameters ​

ParameterTypeRequiredDescription
channel_namestringRequiredThe name of the channel where the entry must be inserted
titlestringRequiredThe title for the entry
statusstringOptionalThe status of the entry
allow_commentsbooleanOptionalAllow comments?
stickybooleanOptionalIs the entry sticky?
custom_fieldsmixedOptionalAny custom fields can be added
categoryarrayOptionalArray of category IDs
member_idintegerOptionalMember ID, otherwise defaults to the logged-in user

Headers ​

HeaderValue
Content-Typeapplication/json

Request Example ​

php
$client = new \GuzzleHttp\Client();

$request = new \GuzzleHttp\Psr7\Request(
    'POST',
    'https://your-domain.com/index.php/webservice/entry',
    ['Content-Type' => 'application/json'],
    json_encode([
        'auth' => [
            'session_id' => 'fa78db6b673b83c211e8cc7153528e9087f62de0',
        ],
        'data' => [
            'channel_name'   => 'news_channel',
            'title'          => 'Test entry',
            'status'         => 'Closed',
            'sticky'         => 'y',
            'allow_comments' => 'n',
            'news_body'      => 'This is a full body text',
            'news_extended'  => 'This is some small text',
            'category'       => [1, 2, 3, 4],
            'custom_file_field' => [
                'filedata' => base64_encode(file_get_contents('path_to_image.jpg')),
                'filename' => 'filename.jpg',
                'dir_id'   => 6,
            ],
        ],
    ])
);

$response = $client->send($request, ['timeout' => 2]);

Response — 200 OK ​

json
{
    "success": true,
    "message": "entry created",
    "data": [
        {
            "entry_id": 42
        }
    ]
}

Response Fields ​

FieldTypeDescription
successbooleantrue when the entry was created successfully
messagestringHuman readable status message
data[].entry_idintegerThe ID of the newly created entry

GET /index.php/webservice/entry — Search / Read Entry ​

Search or retrieve entries from a channel. Since v3.5, read_entry and search_entry are the same method.

Note: the order of the request parameters will be the order of the query.


Request Parameters ​

ParameterTypeRequiredDescription
entry_idintegerOptionalFetch a single entry by ID
channelstringOptionalChannel name — returns all entries in this channel
channel_idintegerOptionalSearch by Channel ID
url_titlestringOptionalSearch by URL title
statusstringOptionalFilter by entry status
limitintegerOptionalMaximum number of results (used with offset)
offsetintegerOptionalResult offset (used with limit)
orderbystringOptionalSort results by this field
sortstringOptionalSort direction (asc or desc)
start_onstringOptionalFilter entries from this date
stop_beforestringOptionalFilter entries before this date
output_fieldsarrayOptionalSpecify fields to return (also applies to relationships)
search_allstringOptionalSearch across all custom fields
grid_field / matrix_fieldstringOptionalSearch in any grid/matrix field
grid_field[col_name] / matrix_field[cell_name]stringOptionalSearch in a specific grid/matrix cell
cat:[field_name]stringOptionalSearch on category fields (cat_id, group_id, cat_name, cat_url_title, or a custom field)
includestringOptionalInclude extra data: channel|categories|author
returnstringOptionalReturn only stats: data[return]=meta

Headers ​

HeaderValue
Content-Typeapplication/json

Request Example ​

GET /index.php/webservice/entry?auth[session_id]=fa78db6b673b83c211e8cc7153528e9087f62de0&data[site_id]=1&data[entry_id]=43
php
$client = new \GuzzleHttp\Client();

$response = $client->get('https://your-domain.com/index.php/webservice/entry', [
    'query' => [
        'auth' => [
            'session_id' => 'fa78db6b673b83c211e8cc7153528e9087f62de0',
        ],
        'data' => [
            'site_id'  => 1,
            'entry_id' => 43,
        ],
    ],
    'timeout' => 2,
]);

Response — 200 OK ​

json
{
    "success": true,
    "message": "entries found",
    "data": [
        {
            "entry_id": 43,
            "title": "My Entry",
            "status": "open",
            "channel_name": "news_channel"
        }
    ]
}

Response Fields ​

FieldTypeDescription
successbooleantrue when the request succeeded
messagestringHuman readable status message
data[]arrayArray of matching entry objects
data[].entry_idintegerThe entry ID
data[].titlestringThe entry title
data[].statusstringThe entry status

Search Mechanism ​

Basic Operators ​
TypeOperatorExample
Contains(empty)data[body]=test
Contains with wildcard(empty)data[body]=~test → results in %test%
Contains NOT(empty)data[body]=not test
Exact matching=data[body]==test
Numeric matching< > <= >=data[body]=>10
Empty fieldIS_EMPTYdata[body]=IS_EMPTY
Not empty fieldIS_EMPTYdata[body]=not IS_EMPTY
OR / AND ​

By default the query is built with AND. To switch to OR, add or before the value:

data[title]=or john
Multiple Values ​

Use a pipe | or comma , to match multiple values (results in an OR query):

data[title]=test|john
sql
title = 'test' OR title = 'john'
Groups ​

Group conditions like you would in SQL: (field = '4' OR field = '5') AND (field = '2' OR field = '3')

The group name can be anything, but must be unique per group.

data[group_one][group_and][][title]=test|john&data[group_two][group_and][][title]=willem|doe
sql
(title = 'test' OR title = 'john') AND (title = 'willem' OR title = 'doe')

PUT /index.php/webservice/entry — Update Entry ​

Update an existing entry by entry ID or search parameters.


Request Parameters ​

ParameterTypeRequiredDescription
entry_idintegerRequired*The entry ID to update
search[]arrayRequired*Identify the entry via search (see Search Mechanism)
titlestringOptionalThe title for the entry
statusstringOptionalThe status of the entry
allow_commentsbooleanOptionalAllow comments?
stickybooleanOptionalIs the entry sticky?
custom_fieldsmixedOptionalAny custom field(s)
categoryarrayOptionalArray of category IDs
member_idintegerOptionalMember ID, otherwise defaults to the logged-in user

*Either entry_id or search[] is required.

Headers ​

HeaderValue
Content-Typeapplication/json

Request Example — by Entry ID ​

PUT /index.php/webservice/entry?auth[session_id]=fa78db6b673b83c211e8cc7153528e9087f62de0&data[site_id]=1&data[entry_id]=3988&data[title]=updated&data[status]=open
php
$client = new \GuzzleHttp\Client();

$request = new \GuzzleHttp\Psr7\Request(
    'PUT',
    'https://your-domain.com/index.php/webservice/entry',
    ['Content-Type' => 'application/json'],
    json_encode([
        'auth' => [
            'session_id' => 'fa78db6b673b83c211e8cc7153528e9087f62de0',
        ],
        'data' => [
            'site_id'        => 1,
            'entry_id'       => 3988,
            'title'          => 'Updated title',
            'status'         => 'open',
            'sticky'         => 'y',
            'allow_comments' => 'n',
            'news_body'      => 'This is a full body text',
            'news_extended'  => 'This is some small text',
        ],
    ])
);

$response = $client->send($request, ['timeout' => 2]);

⚠️ The webservice returns an error if multiple entries match. Use force to update the first match. Updating by entry_id is safer but requires an extra request to look up the ID first.

php
$request = new \GuzzleHttp\Psr7\Request(
    'PUT',
    'https://your-domain.com/index.php/webservice/entry',
    ['Content-Type' => 'application/json'],
    json_encode([
        'auth' => [
            'session_id' => 'fa78db6b673b83c211e8cc7153528e9087f62de0',
        ],
        'data' => [
            'search' => [
                'custom_field' => '=test', // = sign is for explicit matching
                'force'        => true,    // update first match if multiple found
            ],
            'title'  => 'Updated title',
            'status' => 'Closed',
        ],
    ])
);

Response — 200 OK ​

json
{
    "success": true,
    "message": "entry updated",
    "data": [
        {
            "entry_id": 3988
        }
    ]
}

📤 Response Fields ​

FieldTypeDescription
successbooleantrue when the entry was updated successfully
messagestringHuman readable status message
data[].entry_idintegerThe ID of the updated entry

DELETE /index.php/webservice/entry — Delete Entry ​

Delete an entry by its entry ID.


Request Parameters ​

ParameterTypeRequiredDescription
entry_idintegerRequiredThe entry ID to delete

Headers ​

HeaderValue
Content-Typeapplication/json

Request Example ​

DELETE /index.php/webservice/entry?auth[username]=person@gmail.com&auth[password]=1232&data[site_id]=1&data[entry_id]=3983
php
$client = new \GuzzleHttp\Client();

$request = new \GuzzleHttp\Psr7\Request(
    'DELETE',
    'https://your-domain.com/index.php/webservice/entry',
    ['Content-Type' => 'application/json'],
    json_encode([
        'auth' => [
            'username' => 'person@gmail.com',
            'password' => '1232',
        ],
        'data' => [
            'site_id'  => 1,
            'entry_id' => 3983,
        ],
    ])
);

$response = $client->send($request, ['timeout' => 2]);

Response — 200 OK ​

json
{
    "success": true,
    "message": "entry deleted",
    "data": []
}

Response Fields ​

FieldTypeDescription
successbooleantrue when the entry was deleted successfully
messagestringHuman readable status message

Hooks ​

webservice_create_entry_start ​

(added in v3.2.1)

$entry_data = ee()->extensions->call('webservice_create_entry_start', $entry_data);

webservice_create_entry_end ​

(added in v2.2)

ee()->extensions->call('webservice_create_entry_end', $entry_id, $post_data);

webservice_read_entry_start ​

(added in v3.2.1)

$entry_data = ee()->extensions->call('webservice_read_entry_start', $entry_data);

webservice_read_entry ​

(added in v4.4.2)
Runs after the validation

$entry_data = ee()->extensions->call('webservice_read_entry', $entry_data, $post_data);

webservice_read_entry_end ​

(added in v2.2)

$entry_data = ee()->extensions->call('webservice_read_entry_end', $entry_data);

webservice_update_entry_start ​

(added in v3.2.1)

$entry_data = ee()->extensions->call('webservice_update_entry_start', $entry_data);

webservice_update_entry ​

(added in v4.4.2)
Runs after the validation

$entry_data = ee()->extensions->call('webservice_update_entry', $entry_data, $post_data);

webservice_update_entry_end ​

(added in v2.2)

ee()->extensions->call('webservice_update_entry_end', $entry_data, $post_data);

webservice_delete_entry_start ​

(added in v3.2.1)

$entry_data = ee()->extensions->call('webservice_delete_entry_start', $entry_data);

webservice_delete_entry_end ​

(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);

webservice_search_entry_per_entry ​

(added in v3.2)

$entry_data = ee()->extensions->call('webservice_search_entry_per_entry', $entry_data);

webservice_search_entry_per_entry ​

(added in v3.2)

$entry_data = ee()->extensions->call('webservice_search_entry_per_entry', $entry_data);

webservice_search_entry_start ​

(added in v3.2.1)

$entry_data = ee()->extensions->call('webservice_search_entry_start', $entry_data);

webservice_search_entry_end ​

(added in v2.2)

$entry_data = ee()->extensions->call('webservice_search_entry_end', $entry_data);

webservice_entry_row ​

(added in v3.5)
WIll be called when reading an entry

$entry_data = ee()->extensions->call('webservice_entry_row', $entry_data);

webservice_read_entry_matrix ​

(added in v4.0)

ee()->extensions->call('webservice_read_entry_matrix', $value, $col_settings);

webservice_read_entry_grid ​

(added in v4.0)

ee()->extensions->call('webservice_read_entry_grid', $value, $col_settings);