MT#3925 API: more doc and description fixes.

agranig/pbxapi
Andreas Granig 12 years ago
parent 2c49abb49e
commit 1f9e407377

@ -159,6 +159,9 @@ sub field_to_json : Private {
when(/\+NGCP::Panel::Field::EmailList/) { when(/\+NGCP::Panel::Field::EmailList/) {
return "String"; return "String";
} }
when(/\+NGCP::Panel::Field::Identifier/) {
return "String";
}
when(/\+NGCP::Panel::Field::SubscriberStatusSelect/) { when(/\+NGCP::Panel::Field::SubscriberStatusSelect/) {
return "String"; return "String";
} }
@ -200,7 +203,7 @@ sub get_collection_properties {
$name = 'primary_number'; $name = 'primary_number';
} elsif($f->type =~ /AliasNumber/) { } elsif($f->type =~ /AliasNumber/) {
$name = 'alias_numbers'; $name = 'alias_numbers';
} elsif($f->type !~ /Regex|EmailList|SubscriberStatusSelect|SubscriberLockSelect/) { } elsif($f->type !~ /Regex|EmailList|SubscriberStatusSelect|SubscriberLockSelect|Identifier/) {
$name .= '_id'; $name .= '_id';
} }
} }

@ -56,7 +56,7 @@ has_field 'e164' => (
do_wrapper => 1, do_wrapper => 1,
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => ['The main E.164 number used for inbound and outbound calls.'] title => ['The main E.164 number (containing a cc, ac and sn attribute) used for inbound and outbound calls.']
}, },
); );

@ -26,7 +26,7 @@ has_field 'alias_numbers' => (
wrapper_class => [qw/hfh-rep/], wrapper_class => [qw/hfh-rep/],
element_attr => { element_attr => {
rel => ['tooltip'], rel => ['tooltip'],
title => ['Additional E.164 numbers mapped to this subscriber for inbound calls.'] title => ['Additional E.164 numbers (each containing a cc, ac and sn attribute) mapped to this subscriber for inbound calls.']
}, },
); );

@ -1,7 +0,0 @@
{
"_links" : {
"ngcp:resellers": {
"href": "/api/resellers/?id={id}"
}
}
}

@ -1,14 +0,0 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A billing container for a reseller or peering",
"required": ["external_id", "status", "type", "billing_profile_id", "contact_id"],
"properties": {
"status": { "enum": ["active", "locked", "pending", "terminated"], "description": "The operational status of the contract" }
"type": { "enum": ["reseller", "sippeering"], "description": "The type of the contract" }
"contact_id": { "type": "number", "description": "The ID of the 'ngcp:systemcontacts' item this contract belongs to" },
"billing_profile_id": { "type": "number", "description": "The ID of the 'ngcp:billingprofiles' item this contract uses" },
"external_id": { "type": ["null", "string"], "description": "An external ID e.g. to identify the contract in a 3rd party system" },
},
"title": "contract",
"type": "object"
}

@ -1,102 +0,0 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "user preferences for a subscriber",
"required": [],
"properties": {
"attribute": { "type": "string", "description": "The preference name." },
"value": { "type": "string", "description": "The preference name." },
},
"title": "subscriberpreference",
"type": "object"
}
[% #
GET /api/subscriberpreferences/?subscriber_id=10
[
"cli": "12345",
"block_in_list": [ "12345", "12346", "12347" ]
]
POST /api/subscriberpreferences/?subscriber_id=10
[
"cli": "12345",
"block_in_list": [ "12345", "12346", "12347" ]
]
GET /api/subscribers/?id=77
{
"username": "foo",
"_links": [
"callforwards": {
"href": "/api/callforwards/?subscriber_id=987"
},
"cf_destinationsets": {
"href": "/api/destinationsets/?subscriber_id=987"
}
],
}
GET /api/callforwards/?subscriber_id=77
{
# should be separated by cf types
"_links": [
"cfu": {
"href": "/api/callforwards/?id=555"
}
"cfb": {
"href": "/api/callforwards/?id=556"
}
]
}
GET /api/callforwards/?id=555
{
"_links": [
"destinationset": {
"href": "/api/cf_destinationsets/?id=555"
},
"timeset": {
"href": "/api/cf_timesets/?id=556"
},
]
}
GET /api/destinationsets/?subscriber_id=77
PATCH /api/subscribers/?id=77
[
{ "op":
]
$res = $ua->get("/api/subscribers/?id=77")->from_json;
$cf = $res->{_links}->{callforwards}; # "/api/callforwards/?subscriber_id=77
$dsets = $res->{_links}->{cf_destinationsets}; # "/api/cf_destinationsets/?subscriber_id=77
$res = $ua->get($cf->{href})->from_json;
$cfu = $res->{_links}->{cfu}; # /api/callforwards/?id=555
if($cfu) {
$res = $ua->get($cfu)->from_json;
$res = $ua->get($res->{_links}->{collection}->{href})->from_json;
$dset = $res->{_links}->{destinationsets}->[0];
$ua->put($cfu->{href}, "{ \"_links\": [ \"destinationset\": { \"href\": \"$dset->{href}\" }, \"timeset\": null] }");
} else {
$res = $ua->get($dsets->{href})->from_json;
$dset = $res->{_links}->{destinationsets}->[0];
$ua->put($cf->{href}, "{ \"_links\": [ \"destinationset\": { \"href\": \"$dset->{href}\" }, \"timeset\": null] }");
}
-%]

@ -1,18 +0,0 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Contact information for a reseller or peering contract",
"required": ["city", "company", "country", "email", "firstname", "lastname", "phonenumber", "postcode", "street"],
"properties": {
"city": { "type": ["null", "string"], "description": "The contact's city." },
"company": { "type": ["null", "string"], "description": "The contact's company." },
"country": { "type": ["null", "string"], "description": "The contact's country (ISO-3166, e.g. \"AT\" for Austria, \"DE\" for Germany)." },
"email": { "type": "string", "format": "email", "description": "The contact's e-mail address." },
"firstname": { "type": "string", "description": "The contact's given name." },
"lastname": { "type": "string", "description": "The contact's family name." },
"phonenumber": { "type": ["null", "string"], "description": "E.164 number. The contact's officephone number." },
"postcode": { "type": ["null", "string"], "description": "The contact's postal routing code." },
"street": { "type": ["null", "string"], "description": "The contact's street address." }
},
"title": "systemcontact",
"type": "object"
}

@ -52,7 +52,7 @@ Accept-Post: application/hal+json; profile="http://purl.org/sipwise/ngcp-api/#re
To define the page number and the rows per page to return, you can pass the parameters <i>page</i> and <i>rows</i>. Default values are <i>page=1</i> and <i>rows=10</i>, if you do not provide them. To define the page number and the rows per page to return, you can pass the parameters <i>page</i> and <i>rows</i>. Default values are <i>page=1</i> and <i>rows=10</i>, if you do not provide them.
</p> </p>
[% [%
cmd = 'curl -i -X GET -H \'Connection: close\' --cert NGCP-API-client-certificate.pem --cacert ca-cert.pem \'https://example.org:1443/api/' _ id _ '/?page=1&rows=2\''; cmd = 'curl -i -X GET -H \'Connection: close\' --cert NGCP-API-client-certificate.pem --cacert ca-cert.pem \'https://example.org:1443/api/' _ id _ '/?page=1&rows=1\'';
INCLUDE helpers/api_command.tt cmd=cmd level=level+3; INCLUDE helpers/api_command.tt cmd=cmd level=level+3;
props = ' "id" : 1'; props = ' "id" : 1';
@ -311,7 +311,7 @@ Preference-Applied: return=minimal';
-%] -%]
</p> </p>
<h[% level + 2 %]>Update specific fields of an existing <i>systemcontacts</i> item</h[% level + 2 %]> <h[% level + 2 %]>Update specific fields of an existing <i>[% id %]</i> item</h[% level + 2 %]>
<p> <p>
[% [%
props = ''; rem = 0; rep = 0; props = ''; rem = 0; rep = 0;

Loading…
Cancel
Save