...
This documentation provides a step-by-step guide to creating REST APIs for managing CRUD operations for each class using SPARQL templates on the ENAPSO together free platform. By following these instructions, you will be able to automate and enhance the interactivity of your Knowledge Graph through RESTful services.
Why Use Multiple REST Endpoints?
Accessing EBUCorePlus knowledge graphs via multiple REST endpoints, as opposed to a central SPARQL template endpoint, offers several key advantages:
REST Compliance
Standardized Methods: RESTful services use standard HTTP methods (GET, POST, PUT, DELETE) to perform CRUD operations. This makes the API intuitive and easier to use, as developers are already familiar with these methods.
Statelessness: RESTful APIs are stateless, meaning each request from a client contains all the information needed to process the request. This simplifies the server design and improves scalability.
Security
Granular Access Control: Each REST endpoint can be individually secured, allowing you to enforce specific access permissions for different operations. This granular control helps prevent unauthorized access to sensitive data and ensures that only authorized users can perform certain actions.
Reduced Attack Surface: By distributing functionality across multiple endpoints, you limit the impact of potential security vulnerabilities. If one endpoint is compromised, it does not necessarily expose the entire system, enhancing overall security.
Scalability
Load Distribution: With multiple endpoints, you can distribute the load more effectively. Different endpoints can be scaled independently based on demand, leading to better performance and resource utilization.
Access the Swagger Documentation
Navigate to the View Management Service documentation in your web browser. This interface provides access to all the necessary endpoints for managing and executing SPARQL templates.
...
Removing REST API endpoints via OpenAPI
How do I remove REST API endpoints via the OpenAPI?
Find the
delete-endpoint-of-template
endpoint, which is used for removing existing REST APIs of each SPARQL template.Click on the "Try it out" button to enable interactive usage of this endpoint.
Configure the Endpoint Details
In the
records
array, you will configure each CRUD operation as a separate object. Hereโs how you can remove REST endpoints of theEditorialObject
class:Code Block { "records": [ { "endpoint": "editorialObject", "baseURL": "/v1", "endpointConfig": [ { "method": "get", "template": "readEditorialObject" }, { "method": "post", "template": "createEditorialObject" }, { "method": "put", "template": "updateEditorialObject" }, { "method": "delete", "template": "deleteEditorialObject" } ] } ] }
Variable Descriptions
records: This array holds one or more configuration objects.
endpoint: This string specifies the name of the endpoint. It acts as a part of the URL path where the API is accessible. For example,
editorialObject
results in a REST endpoint that could be accessed via${baseURL}/editorialObject
.baseURL: This is the base path under which the endpoint is grouped. For instance, "/v1" indicates that the endpoint is to be accessed under the version 1 group, forming part of the complete URL path. For example,
<http://localhost/enapso-dev/view-management${baseURL}/${endpoint}
> will become<http://localhost/enapso-dev/view-management/v1/editorialObject
.>endpointConfig: An array of objects where each object specifies a CRUD operation and the associated template that needs to be removed.
method: The HTTP method (e.g., "get", "post", "put", "delete") that determines what kind of operation needs to be removed. This corresponds to the CRUD operation:
get
for reading or retrieving data,post
for creating new data,put
for updating existing data,delete
for removing data.
template: The name of the SPARQL template as we create one method for each template name which is called when we send a request on that REST method so as to remove that method.
After entering all the necessary details, click on the "Execute" button. A successful request will create REST endpoints for each configured operation.
The response will indicate success, confirming that the endpoints are removed.
...
This setup enables you to fully utilize the RESTful interface of the ENAPSO together Free free platform, integrating seamlessly with your existing workflows and enhancing data manipulation capabilities through programmatically accessible endpoints. By following these steps, users can effectively create and manage REST APIs for CRUD operations, empowering them to perform sophisticated data interactions directly through HTTP requests.