Skip to content

Edit of post does not work #9

Description

@maximilianredt

Hi,

I've tried to update a post via:

$post = $api->posts->create(
    array(
        'title'          => 'Test Article ' . date('c'),
        'content_raw'    => 'Test Article Description ' . date('c'),
        'date'           => date('c', time()),
        'status'         => 'publish',
        'comment_status' => 'closed'
    )
);
var_dump($post);
$ret = $post->update(
    array(
        'title'          => 'Test Article Updated ' . date('c'),
        'content_raw'    => 'Test Article Description Updated ' . date('c'),
    )
);
var_dump($ret);

I get the following error:

PHP Fatal error:  Uncaught exception 'Requests_Exception_HTTP_412' with message '412 Precondition Failed' in [...]vendor/rmccue/requests/library/Requests/Response.php:92

Any ideas why?

Thanks!

EDIT:
When I debug the Request it looks like the API throws up the following error:
There is a revision of this post that is more recent.
Which does not really make sense, because I just added the entry two lines earlier, does it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions