Skip to content

Instantly share code, notes, and snippets.

@rushfrisby
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rushfrisby/ae50712b8a8a21df7485 to your computer and use it in GitHub Desktop.
Save rushfrisby/ae50712b8a8a21df7485 to your computer and use it in GitHub Desktop.
REST API Contract Spec
{
BasePath: "http://www.domain.com/", //the url of your application's root
Version: 1.0,
Types: [{ //includes custom types and not built-in types like "string". Generics supported.
Name: "NameOfType",
Properties: [{
"NameOfProperty": "TypeOfProperty"
}]
}],
Methods: [{
HttpMethods: ["POST","GET","PUT","DELETE"], //any valid HTTP verbs
RelativePath: "api/Values/{id}", //the url parts to call the method, with format placeholders
Documentation: "this does that", //a brief description about what the method does
ReturnType: "TypeOfResult",
RequestContentTypes: ["xml","json","x-www-form-urlencoded"], //valid Content-Type values (part after the /)
ResponseContentTypes: ["xml","json"],
Parameters: [{
TypeName: "NameOfType",
Name: "NameOfParameter",
Documentation: "this value is...",
Source: "FromUri", //possible choices are FromUri, FromBody, or Unknown
IsOptional: false
}]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment