Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create Posts - Returns Missing Callback Error #58

Closed
danmasta opened this Issue · 1 comment

3 participants

@danmasta

Every time I try to create a posts with the api I get this as a response:

[1]
0:  {
code: "json_missing_callback_param"
message: "Missing parameter data"
}

I have tried both methods outlined here:
https://github.com/WP-API/WP-API/blob/5dfce405e8c84adf6e9491775eff22fe53725e21/docs/routes/posts.md#create-a-post

Any idea what I'm missing?

$.ajax({
            type:'POST',
            url:'/wp-json.php/posts',
            data:{
                'title': 'Test Title'
            },
            contentType: 'application/json',
            success: function(data, textStatus, jqXHR){
                console.log('post creation success! ' + textStatus);
            },
            error: function(jqXHR, textStatus, errorThrown){
                console.log('error creating post, ' + textStatus + ', ' + errorThrown);
            }
        });
@wppd

var content = {'title':'Test Title'};

...
data: JSON.stringify(content),
...

Also, Could you try to use terms_names? I find out the author doesn't implement it yet but I could be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.