The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Good morning,
I've been working on a process to set notifications to off for new parent-observer accounts, and am using the following URL in a PUT to flip the bits, but get an error
.../api/v1/users/self/communication_channels/109328/notification_preferences/new_announcement?as_user_id=102685¬ification_preferences[frequency]=never
The error I get back is "Invalid as_user_id". The user who's token I'm using is a full admin, so they should be able to masquerade. The channel ID and user ID being passed above have been verified.
Other calls to the API that do not use the as_user_id seem to be working fine.
I had this working, I thought, a few weeks back, but can't seem to get it going now.
Thanks for any help offered.
Brian
Hi Brian,
You may be getting invalid as user id because you're passing in the wrong ID.
Is the 102685 coming from your sis or the actual Canvas #sis user id
When looking at a user in Canvas if you look in the URL you can see Canvas's user ID assigned to that user at the end of the url
Hope this helps.
Brian
Hey @bneporadny ,
Yep, I've checked that the user_id is the canvas user ID, and the channel ID is valid for that user.
BM
Does it work when trying the Live API? your.instructure.com/doc/api/live
What scripting language?
I took a few minutes to try this out for you and I was able to get it to work without having to user the as_user_id parameter.
First thing I did was user the communication channels api to get the communication channel ID's associated with the particular user account I was testing with.
I then went to the notification preferences api and plugged in one of the ID's I had gotten from above, entered in the notification I wanted to change and then the frequency and was able to successfully change the notification preference of that particular user without any issues.
Hope this helps. If not let me know what you're seeing and I'll be glad to continue to assist.
Brian
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in