I have a Student add REST api call. This allows candidate data as well as file attachment. Lets say, candidate is added successfully and but the document was not uploaded for some reason. what should be the response status code.
if both are successful, I am returning 200 with the newly created candidate JSON object.
REST API calls should be successful or fail. No half-ways.
If it's not mandatory for creation of account to upload an attachmment, it should be done in a separate call. If an attachment is mandatory (or if provided it's mandatory that it should upload), the request should fail, no user get created and then return a 4xx status code indicating the issue.
Assuming it's not mandatory, I would separate this into 2 different REST calls. Trying to overload too much functionality into one call starts making your api gets messy. I'd recommend creating one call create the user and a second to associate files to the user. Then you just use 201 (created for the new user) and 200 (for successful association of the document) response codes.
One other option: gracefully ignore the failure, create the user, return a 201 and live with the lost attachment :)