Adding a new assignment submission in Moodle (programmatically)

Adding a new assignment submission in Moodle (programmatically)

by aya ashraf -
Number of replies: 0

I have many questions about how to upload new submissions of assignment 

after many searches i knew that h have to call 

1-core_files_upload (this will save draft of file to Moodle)

2-mod_assign_get_assignments (this will get id of assignments for courses for user)

3-mod_assign_save_submission (this will save submission as I want)

my problems : 

1- when I used core_files_upload like : component=user&filearea=draft&itemid=0&filepath=/&contextlevel=user&instanceid=9280&wstoken=xxxxxxxxxxxxxxxxxxx&wsfunction=core_files_upload&moodlewsrestformat=json&filename=aa.txt&filecontent=

I don't know what to write in (filecontent) and what it means by  filepath is that the physical path of the uploaded file n my machine ?

2- when i used the previous URL it gets :

{
    "exception": "webservice_access_exception",
    "errorcode": "accessexception",
    "message": "Access control exception"
}
any ideas to deal with this problems

Average of ratings: -