I'm having an issue where node_save() (inserting new node) ignores some fields in my JSON node. This happens with several content/widget types. I've posted this to Drupal services with no response.
I followed Tyler's post here recommending to do a GET to observe and mimic the JSON format returned - unfortunately I'm finding the format returned in a GET is not always the same format as expected in a node_save() POST. https://github.com/signalpoint/DrupalGap/issues/418
I also saved a node on our Drupal website and captured the format of the POST body, trying to translate that format to analogous JSON. No luck.
Date time field, with start and end date, using Date (Unix timestamp) field type and pop-up calendar widget. Formats recommended in the post below does not save, only default value (now) is saved. Example is field_when_available below. Services module update date field
Integer field types with Text field widget will not save. I've tried over 20 permutations of formats, posted here, no response. htt ps://www.dru pal.org/node/2870095 field_scrap_weight is an example below.
Reference to another node will not save. Same link above describes using target_id, tried that, no success.
What will save are are term reference and List(text) content types from Radio button widgets. field_surplus_type and field_unprepared_or_prepared are examples.
I am posting to http://127.0.0.1:8083/?q=drupalgap/node.json
Below is one example, but I've tried literally hundreds of permutations with and without array brackets, with/without the "und" element, with/without quotes in the data value, etc.
I'm beginning to think there's a more global/systematic issue like a content-type setting.
{
"type": "donation",
"form_id": "donation_node_form",
"language":"und",
"field_unprepared_or_prepared": { // saves OK (List text, checkbox/radio)
"und": {
"value": "unprepared"
}
},
"field_surplus_type": { // saves OK (Term ref, checkbox/radio)
"und": [ 1, 3 ]
},
"field_scrap_weight": { // NOT saved (integer, text field)
"und": {"value": "1"}
},
"field_when_available": { // NOT saved (Unix timestamp), popup calendar
"und":[
{
"value": {
"date": "05/29/2017",
"time":"09:00pm"
},
"value2": {
"date": "05/29/2017",
"time":"09:00pm"
},
"timezone": "America\/New_York",
"timezone_db": "UTC",
"date_type": "datestamp"
}]
},
"field_surplus_location": { // NOT saved - node reference
"und": {"target_id":"256"}
},
"body": { // NOT saved (long text w/summary, text area widget)
"und": {
"value": "dd"
}
}
}