lib/ps_utilities/pre_built_post.rb
# this method CREATES or INSERTS a new student into PowerSchool
# @param params (Array of Hashes) - kids with their attributes use format:
# one kid
# params: { students: [{dcid: 7531, student_id: 23456, email: "kid1@las.ch"}] }
#
# or multiple students (with ps and your school's database extensions)
# params: { students:
#   [ { dcid: 9753, student_id: 65432 },
#     { dcid: 7531, student_id: 23456, email: "kid@las.ch",
#       u_studentsuserfields: {transcriptaddrcity: "Bex"},
#       u_students_extension: {preferredname: "Joe"}
#     }
#   ]
# }
# @return [Hash]
# { "results": {
#     "update_count": 2
#     "result": [
#       {  "client_uid": 124,
#          "status": "SUCCESS",
#          "action": "INSERT",
#          "success_message" :{
#            "id": 442,
#            "ref": "https://server/ws/v1/student/442" }
#        },
#        { ... }
#     ]
#   }
# }
# @note create_students REQUIRED params are: :student_id (chosen by the school same as local_id within PS), :last_name, :first_name, :entry_date, :exit_date, :school_number, :grade_level
# @note create_students OPTIONAL params include: :school_id, :username, :middle_name, physical address objects, mailing address objects, demographics objects, contacts objects, schedule setup objects, intial enrollment objects (disctrict and school), :contact_info, :phone, :u_studentsuserfields (powerschool defined extensions) & :u_students_extension (school defined db extensions)
# @note create_students INVALID (ignored) params are: :id (dcid - chosen by the PS system)
this method CREATES or INSERTS a new student into PowerSchool
this method CREATES or INSERTS a new student into PowerSchool
def create_students(params)
      action   = "INSERT"
      kids_api_array = build_kids_api_array(action, params)
      options  = { body: { students: { student: kids_api_array } }.to_json }
      answer = api(:post, "/ws/v1/student", options)
      return answer.parsed_response   if answer.code.to_s.eql? "200"
      return {"errorMessage"=>"#{answer.response}"}
    end
def create_students ( params ) action = "INSERT" kids_api_array = build_kids_api_array ( action , params ) options = { body : { students : { student : kids_api_array } } . to_json } answer = api ( :post , "/ws/v1/student" , options ) return answer . parsed_response if answer . code . to_s . eql? "200" return { "errorMessage" => "#{answer.response}" } end
this method CREATES or INSERTS a new student into PowerSchool
this method CREATES or INSERTS a new student into PowerSchool
None
Hash
params
(Array of Hashes) - kids with their attributes use format: one kid params: { students:  } or multiple students (with ps and your school's database extensions) params: { students: [ { dcid: 9753, student_id: 65432 }, { dcid: 7531, student_id: 23456, email: "kid@las.ch", u_studentsuserfields: {transcriptaddrcity: "Bex"}, u_students_extension: {preferredname: "Joe"} } ] }
( Array of Hashes ) - kids with their attributes use format : one kid params : { students : } or multiple students ( with ps and your school ' s database extensions ) params : { students : [ { dcid : 9753 student_id : 65432 } { dcid : 7531 student_id : 23456 email : " kid@las . ch " u_studentsuserfields : { transcriptaddrcity : " Bex " } u_students_extension : { preferredname : " Joe " } } ] }
note
create_students REQUIRED params are: :student_id (chosen by the school same as local_id within PS), :last_name, :first_name, :entry_date, :exit_date, :school_number, :grade_level
create_students REQUIRED params are : : student_id ( chosen by the school same as local_id within PS ) : last_name : first_name : entry_date : exit_date : school_number : grade_level
note
create_students OPTIONAL params include: :school_id, :username, :middle_name, physical address objects, mailing address objects, demographics objects, contacts objects, schedule setup objects, intial enrollment objects (disctrict and school), :contact_info, :phone, :u_studentsuserfields (powerschool defined extensions) & :u_students_extension (school defined db extensions)
create_students OPTIONAL params include : : school_id : username : middle_name physical address objects mailing address objects demographics objects contacts objects schedule setup objects intial enrollment objects ( disctrict and school ) : contact_info : phone : u_studentsuserfields ( powerschool defined extensions ) & : u_students_extension ( school defined db extensions )
note
create_students INVALID (ignored) params are: :id (dcid - chosen by the PS system)
create_students INVALID ( ignored ) params are : : id ( dcid - chosen by the PS system )