Second Step: Uploading to a check
Important: A check supports multiple files. Each submission is represented as its own zip file (only zip files are supported) where the source code is stored (structure does not matter). We do not recommend checking hundreds of files at once, as peer check will run each file against one another, which may not complete successfully.
When sending the request, we will need to POST two variables (Content-Type: multipart/form-data):
file - Location of the zip file (must be .zip compressed under 2mb)
check_id - The id of the check you wish to upload the file to
curl -i -X POST \
-H "Content-Type: multipart/form-data" \
-H 'apikey: YOUR_API_KEY_HERE ' \
-F "file=@/test.zip" \
-F "check_id=YOUR_CHECK_ID" \
https://codequiry.com/api/v1/check/upload
Sample Response (JSON Object)
{
"data": [
{
"id": 12,
"filename": "SourceCode-Java",
"status_id": 2,
"created_at": "2019-05-29 21:50:08",
"updated_at": "2019-05-29 21:50:08",
"result1": "0.00",
"result2": "0.00",
"result3": "0.00",
"total_result": "0.00",
"modify_updated_at": "May 29, 2019 9:50 PM UTC",
"assignmentstatuses": {
"id": 2,
"status": "Ready for checking",
"icon": null,
"color": "secondary",
"created_at": null,
"updated_at": null
}
}
],
"file": "SourceCode-Java.zip",
"submission_count": 12,
"check": {
"id": 231,
"name": "Test from API!",
"created_at": "2019-05-29 20:52:02",
"updated_at": "2019-05-29 20:53:57",
"status_id": 2,
"job_id": 0
}
}
Error Format Response (422 error)
{
"error": "The file must be a file of type: zip."
}
About uploading
The uploading endpoint supports concurrent requests, meaning you can have multiple threads sending files to the same check_id. This becomes useful for components such as DropzoneJS.
After you have finished uploading all the necessary zip files, all being the same source language as the language specific upon check creation, we can move to the last step of the checking process.
What's next
For optimal understanding of API usage, we recommend following this guide.