...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "@context": { "id" : "@id", "type" : "@type", "apix" : "http://fedora.info/definitions/v4/apix/", "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "dcterms" : "http://purl.org/dc/terms/", "fedora" : "http://fedora.info/definitions/v4/repository#", "Binding" : {"@id" : "apix:Binding", "@type" : "@id"}, "Registry" : {"@id" : "apix:Registry", "@type" : "@id"}, "Service" : {"@id" : "apix:Service", "@type" : "@id"}, "ZooKeeperBinding" : {"@id" : "apix:ZooKeeperBinding", "@type" : "@id"}, "hasEndpoint" : {"@id" : "apix:hasEndpoint", "@type" : "@id"}, "hasParentZnode" : {"@id" : "apix:hasParentZnode"}, "hasService" : {"@id" : "apix:hasService"}, "hasZooKeeperEnsemble" : {"@id" : "apix:hasZooKeeperEnsemble", "@type": "@id"}, "supportsType" : {"@id" : "apix:supportsType", "@type": "@id"}, "seeAlso" : {"@id" : "rdfs:seeAlso", "@type" : "@id"}, "label" : {"@id" : "rdfs:label"}, "comment" : {"@id" : "rdfs:comment"}, "identifier" : {"@id" : "dcterms:identifier"} } } |
...
id
- a particular Fedora resourcetype
- a comma-delimited list of rdf:type
URIs
Response:
Code Block | ||||
---|---|---|---|---|
| ||||
Content-Type: application/json |
...
Link: |
...
<http://fedora.info/definitions/v4/apix. |
...
jsonld>; rel="describedby"; type="application/ld+json" |
...
{ |
...
"id" : "http://apix-host/apix/registry", |
...
"type" : "Registry", |
...
"hasService" : [ |
...
{ |
...
"type" : "Service", |
...
"label" : "a foo webservice", |
...
"seeAlso" : "http://example.org/foo", |
...
"identifier" : "foo", |
...
"supportsType" : ["fedora:Resource"], |
...
"hasEndpoint" : ["http://host-1/foo/rest", "http://host-2/foo/rest"] |
...
}, |
...
{ |
...
"type" : "Service", |
...
"label" : "a bar webservice", |
...
"seeAlso" : "http://example.org/bar", |
...
"identifier" : "bar", |
...
"supportsType" : ["fedora:Binary"], |
...
"hasEndpoint" : ["http://host-3/bar/rest", "http://host-4/bar/rest"] |
...
} |
...
] |
...
} |
In a similar way, information about a particular service can be retrieved:
GET /apix/registry/foo
Response:
Code Block | ||||
---|---|---|---|---|
| ||||
Content-Type: application/json |
...
Link: |
...
<http://fedora.info/definitions/v4/apix. |
...
jsonld>; rel="describedby"; type="application/ld+json" |
...
{ |
...
"id" : "http://apix-host/apix/registry/foo", |
...
"type" : "Service", |
...
"label" : "a foo webservice", |
...
"seeAlso" : "http://example.org/foo", |
...
"identifier" : "foo", |
...
"supportsType" : ["fedora:Resource"], |
...
"hasEndpoint" : ["http://host-1/foo/rest", "http://host-2/foo/rest"] |
...
} |
Service Endpoints
Registering Services
Services can be registered by interacting with the service registry. This endpoint only registers the existence of a service but does not make any guarantees about any running instances of that service. Such a service must also first be registered before any service instances can be bound to it.it.
Code Block | ||
---|---|---|
| ||
PUT /apix/registry/foo |
...
Content-Type: application/ld+json |
...
{ |
...
"@context" : "http://fedora.info/definitions/v4/apix.jsonld", |
...
"id" : "http://apix-host/apix/registry/foo", |
...
"type" : "Service", |
...
"label" : "a foo webservice", |
...
"seeAlso" : "http://example.org/foo", |
...
"identifier" : "foo", |
...
"supportsType" : ["fedora:Resource"] |
...
} |
Note: the hasEndpoint
element is not included here, but is part of the /bind
interface, described below.
...
Some services may not be able to use dynamic service binding, e.g. a PHP web-application. For these, a manual binding interface is available. This example binds a particular service instance to the already-registered foo
service..
Code Block | ||
---|---|---|
| ||
POST /apix/bind/foo |
...
Content-Type: text/plain |
...
http://host-1/foo/rest |
The response will contain a unique id of this service binding. That URI can be used to unbind the service at a later point.
...
GET /apix/bind/foo
Response:
Code Block | ||
---|---|---|
| ||
Content-Type: application/json |
...
Link: |
...
<http://fedora.info/definitions/v4/apix. |
...
jsonld>; rel="describedby"; type="application/ld+json" |
...
{ |
...
"id" : "http://apix-host/apix/bind/foo", |
...
"type" : ["Binding", "ZooKeeperBinding"], |
...
"hasZooKeeperEnsemble" : ["host-1:2181", "host-2:2181", "host-3:2181"], |
...
"hasParentZnode" : "/service/foo" |
...
} |
At this point (interacting directly with zookeeper), it would be the responsibility of the client to create an ephemeral, sequential znode under /service/foo
, storing the value of the service's endpoint. For example:
...