Skip to content

Instantly share code, notes, and snippets.

@kariudo
Last active August 29, 2015 14:05
Show Gist options
  • Save kariudo/d76e9b2dddbfa6af9fc1 to your computer and use it in GitHub Desktop.
Save kariudo/d76e9b2dddbfa6af9fc1 to your computer and use it in GitHub Desktop.

APIDocs


This project was created to allow for easy updating of our publicly documented API methods. It uses its own API to handle the maintenance of documentation so it is affectionatly refered to by me as MetaDocs.

  • API docs are all saved in their own .JSON files in the configured location.
  • Dispaly pages are generated on the fly from templates using .JSON data.

Project Setup

Setup is easy!

  1. Clone this project to your webserver
  2. Update the configuration files config.php and config.js Set the URL and Base paths as needed in these two files.
  3. Confirm configuration of your .htaccess (should not need to be changed if working) path for admin.php may need to be changed to reflect your own from /.
  4. ???
  5. Profit

Usage & Tips

How to use it, and a few fun tricks and super powers

Edit Mode (edit.html)

  • Edit fields by just double clicking a value.
  • Press [enter] to save changes.
  • Press [esc] to cancel changes.
  • Toggle the published state of the elements with the provided switch.

Code hightlighting and formatting

  • Return values in JSON and XML are automatically displayed in perfect formatting with syntax highlighting!
  • Use [code][/code] tags in your descriptions to have snippets shown in a well with syntax highlighting.
  • [ul][/ul] will create an unordered list, use [li]item[/li] within for items
  • [ol][/ol] will create an ordered list, use [li]item[/li] within for items
  • [a http://example.com]example[/a] will create a link for you
  • You can link directly to a specific call with [a #Miscellaneous_GetUsername]link[/a] where the id is "#Category_CallName" with no spaces or special characters. (Targeted call will be highlighted)

Display Mode (index.html)

  • Its automatic... you don't really have to do anything at all here.
  • If someone tries to get to a doc that doesnt exist a list of availble docs will be shown.
  • Only published elements will be shown to the users

Special notes

[RAW] parameters will not be displayed in query string.

.htaccess

The included .htaccess file configures the REST response redirects for admin.php

Security

Security is handled via PHP and HTTP basic authentication, the admin user/password is configured from the config.php file.

The default is:

admin:apidocs123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment