Simple API call getting "400 Bad Request"

imholzj
imholzj Posts: 7 🔍

I'm not sure why a GET: https://mytest.brightspace.com/d2l/api/lp/1.42/users/myuser returns a 400 Bad Request (Missing or invalid parameters)

I'm following this format: https://docs.valence.desire2learn.com/res/user.html#get--d2l-api-lp-(version)-users-(userId)

any ideas?

jji

Answers

  • There is no such API call, as myuser is not a valid D2LID for a user (the API call you’re using expects to identify the user with a D2LID identifier: a number for the user’s D2L identifier).

    You’re getting a 400 most likely because Brightspace is attempting to bind the myuser part of the API call as a D2L identifier and, as it’s not a number, you’re not simply getting a “404”. The API route does exist; however, you’re providing a bad input parameter (the userId) and this results in the error you’re seeing.

  • imholzj
    imholzj Posts: 7 🔍

    Thanks, now I see that I have to use a result control parameter like this:

    /lp/1.42/users/?UserName=myuser