Published on
1 min read

Apipie - Dumping Examples into apipie_examples File

Authors

Apipie-rails is a DSL and Rails engine for documenting your RESTful API. Since version 0.2.0, the format for storing examples changed from YAML to JSON, with the default location at doc/apipie_examples.json.

Example apipie_examples.json structure:

{
  "channels#index": [
    {
      "verb": "GET",
      "path": "/api/v1/channels",
      "code": 200,
      "response_data": {
        "channels": [
          {
            "id": 1,
            "name": "Channel 1",
            "language_name": "Tamil"
          }
        ],
        "channels_count": 1
      }
    }
  ]
}
API Documentation

Upgrading Examples

If you want to upgrade existing YAML documentation to the newer JSON version, simply run:

rake apipie:convert_examples

This rake task will convert your existing data from .yml to .json and store it in doc/apipie_examples.json.

TwitterLinkedInHacker News