Email or username:

Password:

Forgot your password?
Sean Tilley

Frustrating thing about mastoAPI documentation so far: lack of examples of how a constructed URL should look. I don’t need them often, but sometimes they give useful hints.

The Polls documentation seems to make sense right up until you get to the part about POSTing the choices: https://docs.joinmastodon.org/methods/statuses/polls/

For some reason, the server says this is a bad request:

POST https://social.deadsuperhero.com/api/v1/polls/23184193/votes/?choices[]=3 

But, formatting the number to go inside the array brackets also fails. It’d just be nice to have an example of what the request is supposed to look like.

7 comments
Darius Kazemi

@sean I see where the documentation might be failing you. "choices" isn't a path parameter, it's a "form data parameter", which means it needs to be encoded in the request like form-data davidwalsh.name/curl-post-file

Sean Tilley

@darius oh, that’s kind of confusing.

Usually, when I see “Params”, I kind of assume it means “request params”.

Darius Kazemi

@sean they do label them separately -- this is partly just a problem with form-data in REST APIs. It's confusing.

Sean Tilley

@darius ah, you’re right. I’m still pretty new to this - it can be confusing as to which is which.

Most of the documentation is stellar, and has been really helpful in building my understanding further.

Darius Kazemi

@sean one thing that I wish all REST API endpoint documentation had was a valid example curl request that you can test against.

Sean Tilley

@darius gosh, I feel so silly now. Simply updating my request to “data” instead of “params” 100% fixed it. 😅

Oh god, is this what being a developer is like? 😭

Go Up