Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a node using jQuery to POST JSON.

I get the following error returned by the server: Failed to load resource: the server responded with a status of 406 (Not Acceptable: Node type is required)

However, the type is definitely specified in my JSON string:

var data = '{"title":"Sample post ",
  "type":"article",
  "field_link":
            [{
             "url":"http://www.google.com", 
            "title":"My title"
            }],
  "body":
            {
             "und":[{"value":"comments about something"}]
             }
  }';
share|improve this question
    
Use bit.ly/12wrHAF to debug – Nikhil M Jan 30 '13 at 13:28
  1. try to observe the order of fields like: type > title > body > fields
  2. that is the widget type of "field_link"?
  3. add "und" to this field

    {"title":"Sample post ",
    "type":"article",
    "body":{
    "und":[{
    "value":"comments about something"}]},
    "field_link":{
    "und":[{
    "url":"http://www.google.com",
    "title":"My title"}]}}
    
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.