Python SSAW Interview reject

I am using Python SSWA API.
For Interview reject. I write the following code.

clientA = ssaw.Client(“URL”, “APIUSER”, “Password”, “workspace”)

But, When I run the above code. I got the following exceptions.
ssaw.exceptions.NotAcceptableError: “Interview status is InterviewerAssigned. But one of the following statuses was expected: Completed, ApprovedBySupervisor, RejectedByHeadquarters”

How resolved this problem?

What do you expect will happen when you reject an interview in the status InterviewerAssigned?

The status InterviewerAssigned has not changed. The Interview will reassign to the same interviewer.

Thank you.

You clarified that your expectation is that nothing will change and the program doesn’t change anything.

Why is this a problem?

I have written the python script to reject the Interview. I have used the SSWA package and the InterviewsApi. But When I run my script, I got the exception message.
Please help me to solve this problem?

This is how Survey Solutions works, you can only reject interview when it is in one of those three statuses (completed, approved by supervisor or approved by hq), for any other status you will get an error.
ssaw as a client to the Survey Solutions reflects the same behavior.

You didn’t mention what is the real status of your interview that you’re trying to reject, how are you selecting which one to reject? I’m assuming you’re doing some analysis of incoming data and based on that approve or reject. So the part of those analysis must be(?) to only analyze interviews that are finished (completed)? you wouldn’t want to reject work-in-progress interviews?

So you have two options, the correct (in my opinion) way would be to check the interview status before deciding to analyze/reject/approve. But if you for whatever reason don’t/can’t do it, then you can simply catch the exception:

    InterviewsApi(clientA).reject('interview__id', 'comment')
except NotAcceptableError:
   # any actions that you want to do if this happens

In the text of the error message in an earlier post it was mentioned:

The interview is in “completed” status. I want to write a Python script to reject the interview on some condition. I try following updated code.
clientA = ssaw.Client(“URL”, “APIUser”, “Password”, “workspace”)
InterviewsApi(clientA).reject(‘fad05e17c090493ab5f36f46e9280d5c’, ‘Reject’)
except NotAcceptableError:
But still not working.

Can you give little bit of detail please?

  • ‘not working’ means that you’re still getting the NotAcceptableError exception or any other now?
  • does your apiuser have access to the workspace where this interview is?

If there is another exception thrown, can you post the full trace that you see?

Plus the version of the ssaw package and your server please: