originally posted in:BungieNetPlatform
Been slowly adding [url=http://bungienetplatform.wikia.com/wiki/Category:DestinyService]DestinyService[/url] endpoints to the wikia.
The Endpoint template should include a field for linking to the Official Bungie Help page for that endpoint and probably a way to separate URI parameters from GET/POST payload data. Perhaps have a payload similar to how you are doing the name/desc but output it as a JSON object with syntax highlighting. ie
[quote]== GET/POST Payload ==
<syntaxhighlight lang="javascript">
{
"{name1}": "{value1}",
"{name2}": "{value2}"
}
</syntaxhighlight>
[/quote]
English
-
Update: Turns out you can't put any formatting in a <syntaxhighlight> section, so my first idea didn't work. I did come up with a bit of a hybrid though. I've updated just the [url=http://bungienetplatform.wikia.com/wiki/SetLockState]SetLockState[/url] with the new format. Let me know what you think.
-
Edited by lowlines: 5/27/2015 5:51:21 AMI would probably ditch the wikitable stuff in the template. I tried editing it and it broke almost immediately for me. Perhaps make it the same as the Path Parameters / Query String Parameters where you provide a name and description. The structure can be represented in the Example payload so I don't think we need to duplicate this. Specifying the variable type might also be getting too complicated (and perhaps messy) as a lot of the variables are actually quite loose in what they can take, ie a boolean can be 0 or 1 or "true" or "false" and still work just fine. I'll amend my response codes with the full response. I'll point out I have been trimming down the responses so you only have one index in array objects (ie a list of items will only have the first item), as some of the responses can be quite large (especially if you have a lot of items like me >_<) and the purpose is to have a quick reference, not scroll down pages of what is essentially repeated structure. [edit] Actually after going through and updating the endpoints I have put in so far, I think we don't need the Request Body Structure, just maybe a little revising of the header titles. ie "Path Parameters" could be "URL Path Parameters", and "Query String Parameters" could be "GET/POST (based on the method variable) Query Parameters".
-
The wikitable probably broke because of the escaping. Since the structure was passed as a template parameter, you needed to escape the pipe character by replacing it with {{!}} instead. It's... convoluted, but ultimately I do agree with you. Per your edit: Query string parameters can still exist when POST requests are made. Off the top of my head I don't know if there are any endpoints which do use query string parameters with POST requests, but I'd prefer not to exclude the possibility. I also think it might be confusing if the section is just labelled as POST parameters either because that doesn't communicate to anyone that those parameters must exist in a serialised JSON object - it could come across as p1=v1&p2=v2&p3=v3 instead. So what I'm thinking is a template like this: [quote]Summary [text] Path Parameters [table] Query String Parameters [table] if method is post{ JSON POST Parameters [table] } Example - Request [example URL] [example JSON] - Response [example JSON][/quote]
-
Sorry didn't realize, yes it definitely should indicate that POST data is JSON. Looks good. You might want to do up a public Template example with guidelines on the Wikia for anyone that wants to document other endpoints.
-
Edited by dazarobbo: 5/26/2015 10:18:19 AMI've added in a References section to the Endpoint template, so you can probably just add a citation to the summary which links to the API page. [url=http://bungienetplatform.wikia.com/wiki/GetDestinyAccount]Example[/url]. Absolutely agreed for separating those. I'm thinking there should be a section for: Path Parameters (eg. membershipType, destinyMembershipId) Querystring Parameters (eg. definitions) Request Body (eg. JSON object structure like you mentioned) Only problem is that I don't think wikia supports interpreting wiki parameters like that. What I think we could possibly do is something like the following for [url=http://bungienetplatform.wikia.com/wiki/SetLockState]SetLockState[/url]. [b]Request Body[/b] [quote]{ state: [i]bool: true to lock, false to unlock[/i], membershipType: [i]int: one of [url=http://bungienetplatform.wikia.com/wiki/BungieMembershipType]BungieMembershipType[/url][/i], characterId: [i]string, id of Destiny character[/i], itemId: [i]string, id of item to lock or unlock[/i] }[/quote]Then in the Example section under Request we have a complete JSON object. I'm not sure if that's the best way to represent the body, though. It might also work as a list, but then it becomes difficult to see any deeper objects. I'll make a separate template and see what I can do. Also, just looking through some of the other examples you've put in, I think it might be clearer if the entire response is added { Response: {...}, ErrorCode: 1, ThrottleSeconds: 0, ... } just so it's clearer if someone wants to access something they can see the object path they need to traverse to get to it.