GMLsnip API Docs

GMLsnip offers an easy-to-use API. This allows developers to generate GameMaker Language code snippets by means of calling a URL in their programming language of choice. The API endpoint is accessible at https://www.banack.me/gmlsnip/api.

Please note that this service is being offered with no guarantees of reliability and may be removed without warning. If the API is abused, access to it will be revoked.

URL parameters

There are six parameters, all being optional. Note that all strings must be base64-encoded.

input_str [string]. The GameMaker Language code that will be pretty-printed. For reference, this is the text that's entered into the textarea on the homepage of this website.

snippet_name [string]. The name of the code snippet, the string of text contained in the header of the code block. If this parameter isn't provided, it defaults to the string "GML Code Snippet", as seen on the homepage.

use_lines [boolean]. If true, the code snippet will be generated with line numbers along the left side of the box. Otherwise, no line numbers will be rendered. If this parameter isn't provided, it defaults to true.

use_docs [boolean]. If true, all GameMaker Language-recognized functions (GM8.1, GMS1.4, GMS2) in the code snippet will contain a href links to their respective YoYo Games official documentation entries. Otherwise, function names will not be underlined nor clickable. The list of recognized functions comes from the project, GameMaker Language Functions. If this parameter isn't provided, it defaults to true.

use_copy [boolean]. If true, the code snippet will be generated with a .svg copy button in the upper-right hand corner, allow for easy copying of the code to the end user's clipboard. Code can still be copied by manual means (e.g. ctrl+C, right-click -> copy) even if this parameter is set to false. If this parameter isn't provided, it defaults to true.

use_tooltips [boolean]. Similar to the aforementioned use_docs parameter, this parameter deals with functions recognized in the GameMaker Language Functions project. If true, on-hover tooltips will show a small description of what the function does, per the official YoYo Games documentation. If this parameter isn't provided, it defaults to false.

API response

The API will return JSON in the first paragraph, <p></p>, tag of the document's body, <body></body>.

The JSON contains two objects:

Note: the JSON return strings are URI encoded and must be decoded. The reason for this is because the JSON contains HTML tags which browsers attempt to render.