jsonrest-api.js
function action_putpost(si,args,done) {
    var ent_type = parse_ent(args)

    var ent = si.make(ent_type.zone,ent_type.base,ent_type.name)

    var data = args.data || {}

    var good = _.filter(_.keys(data),function(k){return !~k.indexOf('$')})

    var fields = _.pick(data,good)
    ent.data$(fields)

    if( null != ent_type.entid ) {
      ent.id = ent_type.entid
    }
    else if( null != data.id$ && options.allow_id ) {
      ent.id$ = data.id$
    }

    save_aspect(si,{args:args,ent:ent},done,function(ctxt,done){
      ctxt.ent.save$(function(err,ent){
        var data = ent ? ent.data$(true,'string') : null
        done(err, data)
      })
    })
  }
function action_putpost(si,args,done) {
    var ent_type = parse_ent(args)

    var ent = si.make(ent_type.zone,ent_type.base,ent_type.name)

    var data = args.data || {}

    var good = _.filter(_.keys(data),function(k){return !~k.indexOf('$')})

    var fields = _.pick(data,good)
    ent.data$(fields)

    if( null != ent_type.entid ) {
      ent.id = ent_type.entid
    }
    else if( null != data.id$ && options.allow_id ) {
      ent.id$ = data.id$
    }

    save_aspect(si,{args:args,ent:ent},done,function(ctxt,done){
      ctxt.ent.save$(function(err,ent){
        var data = ent ? ent.data$(true,'string') : null
        done(err, data)
      })
    })
  }
function action_putpost ( si , args , done ) { var ent_type = parse_ent ( args ) var ent = si . make ( ent_type . zone , ent_type . base , ent_type . name ) var data = args . data || { } var good = _ . filter ( _ . keys ( data ) , function ( k ) { return ! ~ k . indexOf ( '$' ) } ) var fields = _ . pick ( data , good ) ent . data$ ( fields ) if ( null != ent_type . entid ) { ent . id = ent_type . entid } else if ( null != data . id$ && options . allow_id ) { ent . id$ = data . id$ } save_aspect ( si , { args : args , ent : ent } , done , function ( ctxt , done ) { ctxt . ent . save$ ( function ( err , ent ) { var data = ent ? ent . data$ ( true , 'string' ) : null done ( err , data ) } ) } ) }
lenient with PUT and POST - treat them as aliases, and both can create new entities
lenient with PUT and POST - treat them as aliases and both can create new entities