Attach files to results

For a resultType = document you should attach files to the assessment results through the following endpoint: /assessments/{assessmentOrderId}/results/{resultId}/attachments

Note: This is a required step if you’ve selected resultType = document. If a file is not attached, the result for a SmartRecruiters customer will not be displayed.

Attach files to an assessment result

The following http POST request can be sent to attach the file to your assessment result. The API looks for a part containing the “attachment” control name in the multipart/form-data content-type.

Example Curl request will look like this:

curl -i -H "X-SmartToken:abc123" -F "attachment=@JavaTestScore.pdf;type=application/pdf" -X POST https://api.smartrecruiters.com/v1/assessments/511a3942300469a9c33819d1/results/511a3942300469a9c33819d1/attachments

And here’s an example POST request to send the attachment file:

POST /assessments/511a3942300469a9c33819d1/results/511a3942300469a9c33819d1/attachments HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7d44e178b0434
Host: api.smartrecruiters.com
Content-Length: 178532
Accept: application/json;charset-UTF8
X-SmartToken: abc123
-----------------------------7d44e178b0434
Content-Disposition: form-data; name="attachment"; filename="JavaTestScore.pdf"
Content-Type: application/pdf

-----------------------------7d44e178b0434

Check files attached to assessment result

All files attached to a particular assessment result can be checked using the following GET request:

curl -i -H "X-SmartToken: abc123" -X GET https://api.smartrecruiters.com/v1/assessments/511a3942300469a9c33819d1/results/3aa13942300469a9c3381222/attachments

Response Body:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "limit": 10,
    "offset": 0,
    "totalFound": 3,
    "content": [
        {
            "id": "511a3942300469a9c33819d8",
            "createDate": "2013-03-13T14:44:24.108+0000",
            "lastUpdateDate": "2013-03-15T10:20:12.108+0000",
            "fileName": "JetLi_JavaTest.pdf"
        },
        {
            "id": "333a3942300469a9c33819d8",
            "createDate": "2013-03-13T14:44:24.108+0000",
            "lastUpdateDate": "2013-03-15T10:20:12.108+0000",
            "fileName": "JetLi_EjbTest.pdf"
        },
        {
            "id": "333a3942300469a9c3381aaa",
            "createDate": "2013-03-13T14:44:24.108+0000",
            "lastUpdateDate": "2013-03-15T10:20:12.108+0000",
            "fileName": "JetLi_RubyTest.pdf"
        }
    ]
}

The response will contain a ListResult object with a list of AssessmentResultAttachment objects.