Joyce API
joyce-rest
is the main interface to consume the final output of Joyce transofrmations.
It expose a REST and a GraphQL interface to read and a JSON-RPC interface to propagate other operations to the source backend systems.
#
ConfigurationThe api needs a json config file that defines which schemas to serve, this enables you to spawn different instances of the api if you want to serve different content to different endpoints.
The configuration file is really simple:
ie.
The file is read at startup so you have to already have the schema stored within the import gateway.
joyce-rest
read the schema and parses its $metadata, knowing the shape of the content, the collection and unique id of content.
#
RESTWith this information it will expose a Swagger documentation of the API at /docs
.
For every schema configured two enpoint are exposed:
- one to retrive a single content by uid
/[PATH]/[UID]
- one to list content
/[PATH]
that can be paged, ordered and filtered
#
JSON-RPCAPI are read-only, only GET endpoint are exposed for the collections, but the platform enables also a way to push back writes, but following a CQRS approach does it in a different way.
There is a /jrpc
endpoint where you can send json-rpc messages that will be published on a joyce_command
topic, that you can consume with custom code to make changes to the backend systems that owns the row data.
#
GraphQLThis service will expose also a GraphQL interface at /query
and a playground at /graphql
.
The schema is transposed to a graphql schema automatically by using GraphQL Mesh