diff options
author | Tim Bunce <Tim.Bunce@pobox.com> | 2010-11-23 13:30:57 +0000 |
---|---|---|
committer | Tim Bunce <Tim.Bunce@pobox.com> | 2010-11-23 13:30:57 +0000 |
commit | db3585960c906395100c0233e738fbe8b4396af6 (patch) | |
tree | 087cb35ef08771b575811db98c8047d8fd8bfa4e /spec/spore_description.pod | |
parent | Add is_success method to Net/HTTP/Spore/Response.pm (diff) | |
download | net-http-spore-db3585960c906395100c0233e738fbe8b4396af6.tar.gz |
Remove outdated spec/ files. Add github.com/SPORE/specifications link to docs.
Diffstat (limited to 'spec/spore_description.pod')
-rw-r--r-- | spec/spore_description.pod | 303 |
1 files changed, 0 insertions, 303 deletions
diff --git a/spec/spore_description.pod b/spec/spore_description.pod deleted file mode 100644 index 0feef05..0000000 --- a/spec/spore_description.pod +++ /dev/null @@ -1,303 +0,0 @@ -=encoding utf-8 - -=head1 NAME - -Spore (Specifications to a POrtable Rest Environment) Description Implementation - -=head1 ABSTRACT - -Spore is a specification for describing ReST API that can be parsed and used -automatically by client implementations to communicate with the descibed API. - -This document describes how to write the description for a ReST API in -order to be used with a SPORE Client Implementation. - -=head1 TERMINOLOGY - -=over 4 - -=item API - -An I<API> is a ReST application that can exchange data with client -applications over http/https. It presents one or more method endpoints which -accept http requests with varying headers, parameters and body content to -perform specific operations. - -=item Client implementation - -A I<Client implementation> is a library targeting a specific system or -language. It can use I<Descriptions files> to create programmatic interfaces -usable in applications. - -=item Description file - -A I<Description file> is a file in JSON format describing an I<API> (see -specification). It can directly be used by a I<Client implementation> to -create a programmatic interface in the target system. - -=back - -=head1 API DESCRIPTION - -An API should provide a description file. The description should be in JSON -format. - -XXX all the example should be changes to use valid json fragments instead of yaml. -I've noted the obvious cases (lists) but the others also need changing to add double quotes etc. - -=head2 GENERIC DESCRIPTION - -This part describes the API itself: - -=head3 name - -An optional simple name to describe the specification - - "name" : "CouchDB" - -=head3 author - -An optional list of authors for this specification - - "author" : [ - "franck cuny <franck@lumberjaph.net>" - ] - -XXX should be renamed to be plural? - -=head3 api_base_url - -An optional base fixed URL for this API - - "api_base_url" : "http://api.twitter.com/1" - -Should not including a trailing slash. - -=head3 api_format - -An optional list of supported formats - - "api_format" : [ - "json" - "xml" - ] - -XXX what does "supported format" actually mean? What's the effect? - -=head3 version - -An optional version number for the current description, expressed as a string - - "version" : "0.1" - -This is purely for documentation. - -=head3 authentication - -An optional boolean to specify if this API requires authentication for all the methods - - "authentication" : 1 - -The default is false. - -=head3 methods - -A mandatory hash of method names and specifications. -See L</METHOD DESCRIPTION>. - - "methods" : { ... } - -The C<methods> hash B<MUST> contain at least one method. - -=head2 METHOD DESCRIPTION - -A method must have a name, which is the key in the L</methods> hash - - "methods" : { - "public_timeline" : { ... } - } - -=head3 method - -The mandatory C<method> attribute specifies the HTTP method to use for this call - - "method" : "GET" - -=head3 path - -The mandatory C<path> attribute specifies the URI path for this method. - - "path" : "/login" - -The path can contain I<placeholders>. A placeholder -B<MUST> begin with a <:>: - - "path" : "/statuses/public_timeline.:format" - -XXX How can non-placeholder :foo's be included in the path? ie is there an escape mechanism? -XXX What happens in this example if 'format' isn't listed in params/required? -XXX What happens if a parameter needs to be followed by a word character? ie can something like :{format}foo be used? - -=head3 params - -An optional list of I<optional> parameters (contrast with L</required>). -This list will be used to replace value in placeholders, -and if not used in the path, will be added to the query. - - "params" : [ - "trim_user", - "include_entities" - ] - -=head3 required - -An optional list of I<required> parameters (contrast with L</params>). -This list will be used to replace value in placeholders, -and if not used in the path, will be added to the query. - -Parameters that are required B<MUST NOT> be repeated in the B<params> field - - "required" : [ - "format" - ] - -=head3 expected - -An optional list of valid HTTP response status values for this method - - "expected" : [ - 200, - 204 - ] - -An exception will be thrown if C<expected> is specified and some other status -value is returned. Otherwise an exception won't be thrown, even for error status values. - -XXX a global api_expected would be handy. -XXX a global way to express "throw exception for all 4xx and 5xx (unless expected)" would be good. - -=head3 description - -An optional simple description for the method. This should not be considered as -documentation. - - "description" : "Returns the 20 most recent statuses, including retweets if they exist, from non-protected users" - -=head3 authentication - -An optional boolean to specify if this method requires authentication - - "authentication" : 0 - -The default is false. - -=head3 base_url - -An optional base url for this method, if different to L</api_base_url> - - "base_url" : "http://api.twitter.com/1" - -Should not include a trailing slash. - -XXX would be nice to be able to express this as a relative url (relative to api_base_url) That could be handled at build time. - -=head3 format - -An optional list of supported formats for this method, if different to L</api_format>: - - "format" : [ - "json", - "xml" - ] - -=head3 documentation - -Optional complete documentation text for the method - - "documentation" : "The public timeline is cached for 60 seconds. Requesting more frequently than that will not return any more data, and will count against your rate limit usage." - -=head2 SAMPLE - -A description for the twitter API (only the API description part and the first method): - - { - "api_base_url" : "http://api.twitter.com/1", - "version" : "0.1", - "methods" : { - "public_timeline" : { - "params" : [ - "trim_user", - "include_entities" - ], - "required" : [ - "format" - ], - "path" : "/statuses/public_timeline.:format", - "method" : "GET" - }, - } - } - -=head2 CALLS - -XXX - -=head1 CHANGELOGS - -=head2 0.1 - 2010.10.xx - -Initial version. - -=head1 ACKNOWLEDGEMENTS - -Some parts of this specification are adopted from the following specifications. - -=over 4 - -=item * - -PSGI Specification L<PSGI|http://search.cpan.org/perldoc?PSGI> - -=item * - -PEP333 Python Web Server Gateway Interface L<http://www.python.org/dev/peps/pep-0333> - -=item * - -Rack L<http://rack.rubyforge.org/doc/SPEC.html> - -=item * - -JSGI Specification L<http://jackjs.org/jsgi-spec.html> - -=back - -I'd like to thank authors of these great documents. - -=head1 AUTHOR - -=over 4 - -=item franck cuny - -=item nils grunwald - -=back - -=head1 CONTRIBUTORS - -=over 4 - -=item damien "bl0b" leroux - -=item Tim Bunce - -=back - -=head1 COPYRIGHT AND LICENSE - -Copyright XXX, 2010. - -This document is licensed under the Creative Commons license by-sa. - -=cut |