MT#14477 Documentation enchancement for asynchronous API collections

Change-Id: Iec515efd05b47ea0e35594be445f7d55f9e70dfb
changes/45/2745/3
Irina Peshinskaya 10 years ago
parent 1a3e7dd75b
commit 1ff49c10da

@ -23,6 +23,13 @@ class_has 'api_description' => (
default =>
'Defines the meta information like duration, sender etc for fax recordings. The actual recordings can be fetched via the <a href="#faxrecordings">FaxRecordings</a> relation. NOTE: There is no Location header in the POST method response, as creation is asynchronous.',
);
class_has 'properties' => (
is => 'ro',
isa => 'HashRef',
default => sub { {
asynchronous => 1,
}; },
);
class_has 'query_params' => (
is => 'ro',

@ -160,6 +160,7 @@ sub GET : Allow {
item_actions => $item_actions,
sorting_cols => $sorting_cols,
uri => $uri,
properties => ( $full_mod->can('properties') ? $full_mod->properties : {} ),#
sample => $full_mod->can('documentation_sample') # generate pretty json, but without outer brackets (this is tricky though)
? to_json($full_mod->documentation_sample, {pretty => 1}) =~ s/(^\s*{\s*)|(\s*}\s*$)//rg =~ s/\n /\n/rg
: undef,

@ -242,10 +242,12 @@ Content-Type: application/json
{
' _ props _ '}';
response =
'HTTP/1.1 201 Created
Location: /api/' _ id _ '/2';
response = 'HTTP/1.1 201 Created';
IF !col.properties.asynchronous ;
response = response _ '
Location: /api/' _ id _ '/2' ;
END ;
INCLUDE helpers/api_req_res.tt request=request response=response level=level+3;
%]
</p>

Loading…
Cancel
Save