-
-
Notifications
You must be signed in to change notification settings - Fork 968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add examples and more explanation to the API documentation #267
Comments
Both are accepted in both cases actually, but that base64 bit was submitted by an outside contributor, it'd be nice to have some consistency there. |
To answer one of my questions, a "card" is one of those preview thingies that are shown for links to some official/commercial sites. And to add some more questions,
|
Yes, correct. It's a tree view so it's difficult to paginate, easier to just return all results
Mistake
I actually added documentation for that recently! |
Ah, I should've reloaded the tab before asking about it ^_^; Thanks for the quick updates. Still hoping for an example of the since_id / max_id thing. I've figured out how to get that Link: header from curl, but I don't get how they're used. The max_id / rel="next" one seems to go forward in the list, the other only jumps back to the beginning? I'm probably doing something worng >_<; The IDs also don't seem to correspond for the accounts/id/following endpoint (probably others too, but this was the one I was trying out just now). max_id and since_id have completely different values than the IDs of the user accounts that are returned. And maybe I should report this over on the main source github as a bug, but is it correct that I'm getting an error "This action is outside the authorized scopes" when trying to get a list of blocked accounts through the blocks endpoint with an app that has read & write scope (but not follow)? I'd expect read scope alone to be enough to use all the GET endpoints at least. In order to display toots properly you need to know what to not display, isn't it? |
If you want to build an application (and not a library), I recommend you to pick a library that wraps the Mastodon API other developers already implemented. You can find the list here. |
The ID depends on the endpoint. For a timeline (status array), the id is the status id. For and endpoint that returns an account array, it's the account id.
public enum AccessScope {
/// Allows reading data.
case read
/// Allows posting statuses and uploading media for statuses.
case write
/// Allows following, unfollowing, blocking, and unblocking users.
case follow
}
Read access gives access to toots. Follow access isn't necessary for that. |
So it is a bug then to get that error accessing the blocks endpoint? I'm not trying to block an account, only to get a list of blocked accounts (https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#blocks) As for the library thing, yah, but my language of choice is Lua. There is a lua-mastodon library, but it can't even upload media because the library it depends on for http communication doesn't do uploads. So I'm reinventing that wheel for myself ^_^; The lua-curl library looked super complicated, so for now I'm just using commandline curl. Re: IDs, the accounts/id/followers endpoint just now returned accounts with IDs 6393 and 10881 (using limit=2 to not flood my screen), and the Link: header suggested a since_id of 63369 and a max_id of 62490. They don't seem to be related at all :/ |
Yes, they're not related. You should use the values from the Link header. |
Okay, that was my guess, but the API documentation suggests that they are related, apparently even confusing @ornithocoder above. That leaves the pagination not going back and forth quite right. The link that says max_id=something and rel="next" works to get the next 'page' of results, but the other link (since_id=somethingelse and rel="prev") doesn't go back to the previous 'page' of results and instead gives the first 'page' of results again. Am I doing it worng? |
This is great feedback, @kimik0! Exactly the kind of thing that will make the docs better in the future. I'm going to take all this into consideration and see if I can do a documentation pass to clarify all these. |
Thanks. I'm glad my questions are useful. And it's pretty cool to be talking to celebs like Gargron and DariusK *^_^* Ah, one more. What is the point of the notifications/id endpoint if the only way to find that id is from the notification itself? I mean, I'd need to already have the notification in order to get it.. o_0 |
Now getting into the actual data (instead of only fetching it). Is there a reason for Is a toot's The Formatting consistency nitpick: |
I believe since that issues was opened the docs have improved in some matters? @kimik0 please review whether that issue should still be open. |
I'm not sure if it's okay to ask for this, but it's pretty hard to figure out how to use the API properly >_<;
For example, several endpoints mention to get max_id and since_id from something called a "link header". (for example https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#getting-who-account-is-following). The only explanation of what a "link header" is is at the top of the page as a link to an RFC. A simple example would explain things much quicker and simpler than pointing to an abstract and complex design document.
Another example, it's mentioned at the top of the page that a file needs to be "form-encoded". But later on, https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#updating-the-current-user says that images need to be "base64 encoded". So, which is it? Are they different? How to accomplish these encodings? An example of an API call that accomplishes the thing properly would be much easier to understand than describing it in words.
Some other things that aren't explained:
The text was updated successfully, but these errors were encountered: