Skip to content

Instantly share code, notes, and snippets.

@manuelmeurer
Last active January 3, 2016 01:49
Show Gist options
  • Save manuelmeurer/0678cc19922ccabdfe46 to your computer and use it in GitHub Desktop.
Save manuelmeurer/0678cc19922ccabdfe46 to your computer and use it in GitHub Desktop.
{
"base": "https://api.myapp.com/", // Base URL of the api
"version": "v1", // Default version for the api (https://api.example.com{/version}/users) [optional]
"no_verify_ssl": true, // Do not verify SSL cert [optional] (default: false)
"authorization": { // Authorization strategies
"basic" : false, // Basic authentication [optional] (default: false)
"header": false, // Token in authorization header [optional] (default: false)
"oauth" : false // OAUTH authorization [optional] (default: false)
},
"request": { // Settings for requests to the api
"formats": { // Format of the request body
"default": "form", // Default format for the request body [optional] (default: raw)
"json": true // Support json? [optional] (default: false)
}
},
"response": { // Settings for responses from the api
"formats": { // Format of the response body
"default": "json", // Default response format. Used when 'suffix' is true [optional] (default: html)
"json": true // Support json? [optional] (default: false)
},
"suffix": true // Should the urls be suffixed with response format? [optional] (default: false)
},
"error": { // Required if response format is 'json'
"message": "error" // The field to be used from the response body for error message
},
"class": { // The classes for the api
"accounts": { // Name of a class of the api
// "args": ["api_key"], // Arguments required for the api class [optional]
"show": { // Name of a method of the api
"path": "/accounts/show", // Url of the api method
"method": "get", // HTTP method of the api method [optional] (default: get)
"params": [ // Parameters for the api method [optional]
{
"name": "api_key", // Name of the parameter
"required": true // The parameter will become an argument of api method
}
]
}
}
}
}
{
"accounts": { // Name of a class of the api
"title": "Accounts", // Title of the api class
"desc": "Returns accounts API instance", // Description of the api class
// "args": { // Arguments of the api class
// "id": { // Name of the argument
// "desc": "Username of the user", // Description of the argument
// "value": "pksunkara" // Value of the argument in docs
// }
// },
"show": { // Name of a method of the api
"title": "Show account", // Title of the api method
"desc": "Show the user's account", // Description of the api method
"params": { // Parameter of the api class
"api_key": { // Name of the parameter
"desc": "API key", // Description of the parameter
"value": "foobar" // Value of the parameter in docs
}
}
}
}
}
{
"name": "ProductWidgets", // Name of the api (also used as class name for the library)
"package": "myapp-api", // Name of the package
"version": "0.0.1", // Version of the package
"url": "http://api.myapp.com/", // URL of the api
"keywords": ["myapp", "api"], // Keywords for the package
"official": true, // Are the api libraries official?
"author": {
"name": "Kraut Computing", // Name of the package author
"email": "info@krautcomputing.com", // Email of the package author
"url": "http://github.com/krautcomputing" // URL of the package author
},
"git": { // Used in the package definition
"site": "github.com", // Name of the git website
"user": "krautcomputing", // Username of the git website
"name": "myapp" // Namespace of the git repositories
},
"license": "MIT", // License of the package
// "php": { // Required only if creating php api lib
// "vendor": "pksunkara" // Packagist vendor name for the package
// },
// "python": { // Required only if creating python api lib
// "license": "MIT License" // Classifier of the license used for the module
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment