Error message assignee: Not a user in Organisation on one particular resource

I have been using the API for some months now but this last week I have noticed my code no longer functions when trying to assign one particular user as an assignee to a task. Has an API change happened recently?

I’m getting a status 400, bad request, with response text "{“errors”:[{“message”:“assignee: Not a user in Organization: [object Object]”,“help”:"For more information on API status codes and how to handle them, read the docs on errors: ". The code works absolutely fine will all other users I have tried.

Thanks in advance for any help you can provide.

Hi @Tim_Keep1,

No recent API changes I can think of that would cause this to start happening now.

What I think I would do is use the Workspace Memberships functionality to see if and how this person shows up in that workspace:
https://asana.com/developers/api-reference/workspace_memberships

You should be able to use the API Explorer to investigate without having to write any code.

1 Like

Any chance this is related to the recent changes with the id and gid field? What if you ask for a user based on its id but your app is made to work with gid?

1 Like

Thanks for idea and pointer to the API Explorer Phil. I had not seen this before and it will be very useful. Unfortunately it has not helped this time. I cannot see any difference between the workspaces (only have 1 workspace) for any of the users. I’m going to carry on experimenting and hopefully find something that solves the problem.

Hi @Joe_Trollo @Ross_Grambo, any ideas on why he would get that error message if the user is in the organization?

I can’t be sure of this without seeing the request that’s having an issue, but my suspicion here is that the request is structured improperly. If you were to have sent a request that has "assignee": "user@domain.com" then I would have expected the error message to read assignee: Not a user in Organization: user@domain.com. However, the [object Object] in the message you posted leads me to believe that the request is passing in an entire object for the assignee, and not just the user’s GID or email address.

@Tim_Keep1, can you confirm the structure of your API request body is correct? Or perhaps paste the body of the failing request into this thread?

1 Like

Thanks Joe, I am passing the whole object in. This does work for every other resource in my organisation and I thought this was the correct request structure. I have just spotted the problem in writing this reply for you as it has forced me to look at it more carefully! I’m normally sending

“assignee”:{“gid”:“123456789123456”,“resource_type”:“user”}

but for some reason the quotes are missing from around the gid number just for this user. This user does have quite a different number from the others (starting with a 1) so must be showing up a bug in my Json library. As I previously stated, it used to work without issue, but I have changed from a 32 bit to a 64 bit version of MS Office which I am using with this particular program written in VBA.

Thanks to all of you who replied and took your time to think about this, and I’m embarrassed it has transpired to be my code! Although you didn’t directly solve the issue, it has helped me find it and I have learnt more about the API along the way. You are very much appreciated.

If I am not mistaken, you should just give the gid directly in the assignee field. The documentation could be confusing about this…

I will try this, although sending the object is working for me at the moment. I have a vague memory of trying just the gid and it didn’t work. This is during a PUT request to update a task if that makes any difference?

As @Bastien_Siebman said, you can just pass the gid, no need for the whole User object.

1 Like