API Resolver is an instance of API Platform framework. It serves as an inbetween node in order to semantically match RESTFul API providers and clients. It requires the Apache Jena/Fuseki for it's triplestore. It's role is to save the main JSON-LD graph from other API-Platform servers and match those with the requested APIs from the clients.
Currently it uses the @type
term to match the type of desired data and the schema.org/Actions to assign semantic meaning to HTTP methods.
API providers should consider the API-Platform documentation on building their service.
While API consumers that would like to use the API-Resolver should have a look at schydraClient.
- Download the binary Apache Jena/Fuseki
- Start Jena
./fuseki-server --port 8090
and create a new dataset. - Navigate to $FUSEKI_BASE/run
- shiro.ini is used to configure Fuseki and select desired access rights doc.
- Navigate to $FUSEKI_BASE/run/configuration/$DATASET_NAME, and allow default graph to be the union of every contained graph as below:
:tdb_dataset_readwrite
a tdb:DatasetTDB ;
tdb:unionDefaultGraph true ;
tdb:location "/home/mits/schydra/jena/apache-jena-fuseki-3.4.0/run/databases/thesis" .
-
Get the API-Resolver server
git clone https://gitlab.com/cr3a7ure/api-resolver.git
. -
Install dependancies:
cd api-resolver
php composer.phar update
-
Fill in the specified parameters or edit
/app/config/parameters.yml
. A database is required even though it could be empty. The SPARQL endpoint is essential. The parameters:sparql_host
: Base URL of Apache Jena/Fuseki, mind the slash/
.readonly_dataset
: Readonly dataset for matching. You can upload graphs through Jena only.test_dataset
: Testing dataset for uploading graphs through API-Resolver.
php bin/console doctrine:database:create
. -
Start locally the API-Resolver
php bin/console server:start 0.0.0.0:8091
.
API-Resolver points to http://localhost:8090
on default for its triplestore and it's dataset name is thesis
.
In order to change those, currently you have to manually saerch for it inside the /src/AppBundle/Action
.
You have to manually load the main graph of your API-Platform server in your dataset, or use the testing API.
As seen above, API-Resolver's main job is to create SPARQL queries and answer to clients' requests.
It helps pre/post-process the data. Since working with SPARQL queries is not as easy.
The client should make an HTTP PUT at API-Resolver_BASEURL/api/match
using as data a JSON-LD description of the requested APIs.
The API-Resolver will return another JSON-LD graph describing each class with it's actions.
API-Platform wrapper servers:
The new breed of web frameworks
The official project documentation is available on the API Platform website.
API Platform is a next-generation PHP web framework designed to easily create API-first projects without compromising extensibility and flexibility:
- Expose in minutes an hypermedia REST API that works out of the box by reusing entity metadata (ORM mapping, validation and serialization) ; that embraces JSON-LD, Hydra and such other data formats like HAL, YAML, XML or CSV and provides a ton of features (CRUD, validation and error handling, relation embedding, filters, ordering...)
- Enjoy the beautiful automatically generated API documentation (Swagger)
- Use our awesome code generator to bootstrap a fully-functional data model from Schema.org vocabularies with ORM mapping and validation (you can also do it manually)
- Easily add JSON Web Token or OAuth authentication
- Create specs and tests with a developer friendly API context system on top of Behat
- Develop your website UI, webapp, mobile app or anything else you want using your preferred client-side technologies! Tested and approved with React, AngularJS (integration included), Ionic and native mobile apps
API Platform embraces open web standards (Swagger, JSON-LD, Hydra, HAL, JWT, OAuth, HTTP...) and the Linked Data movement. Your API will automatically expose structured data in Schema.org/JSON-LD. It means that your API Platform application is usable out of the box with technologies of the semantic web.
It also means that your SEO will be improved because Google recommends these formats. And yes, Google crawls full-Javascript applications as well as old-fashioned ones.
Last but not least, API Platform is built on top of the Symfony full-stack framework and follows its best practices. It means than you can:
- use thousands of Symfony bundles with API Platform
- integrate API Platform in any existing Symfony application
- reuse all your Symfony skills and benefit of the incredible amount of Symfony documentation
- enjoy the popular Doctrine ORM (used by default, but fully optional: you can use the data provider you want, including but not limited to MongoDB ODM and ElasticSearch)
Read the official "Getting Started" guide.
API Platform provides rock solid foundations to build your project:
- The Schema Generator to generate PHP entities from Schema.org types with Doctrine ORM mappings, Symfony validation and extended PHPDoc
- The API Platform Core Library to expose in minutes your entities as a JSON-LD and Hydra enabled hypermedia REST API
- Swagger UI integrated with the API bundle to automatically generate a beautiful human-readable documentation and a sandbox to test the API
- Behat and Behatch configured to easily test the API
- The full power of the Symfony framework and its ecosystem
- Doctrine ORM/DBAL
- An AppBundle you can use to start coding
- Annotations enabled for everything
- Swiftmailer and Twig to create beautiful emails
It comes pre-configured with the following bundles:
- Symfony - API Platform is built on top of the full-stack Symfony framework
- API Platform's API bundle - Creates powerful Hypermedia APIs supporting JSON-LD and Hydra
- DunglasActionBundle - Automatically register actions, commands and event subscribers as a service
- NelmioCorsBundle - Support for CORS headers
- NelmioApiDocBundle - Generates a human-readable documentation
- FosHttpCacheBundle - Add powerful caching capacities, supports Varnish, Nginx a built-in PHP reverse proxy
- SensioFrameworkExtraBundle - Adds several enhancements, including template and routing annotation capability
- DoctrineBundle - Adds support for the Doctrine ORM
- TwigBundle - Adds support for the Twig templating engine (useful in emails)
- SecurityBundle - Authentication and roles by integrating Symfony's security component
- SwiftmailerBundle - Adds support for Swiftmailer, a library for sending emails
- MonologBundle - Adds support for Monolog, a logging library
- WebProfilerBundle (in dev/test env) - Adds profiling functionality and the web debug toolbar
- SensioDistributionBundle (in dev/test env) - Adds functionality for configuring and working with Symfony distributions
- SensioGeneratorBundle (in dev/test env) - Adds code generation capabilities
All libraries and bundles included in API Platform are released under the MIT or BSD license.
Json Web Token is a lightweight and popular way to handle authentication in a stateless way. Install LexikJWTAuthenticationBundle to adds JWT support to API Platform.
Oauth support can also be easily added using FOSOAuthServerBundle.
Enjoy!
Created by Kévin Dunglas. Sponsored by Les-Tilleuls.coop Commercial support available upon request.